news.component.js 573 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. angular
  3. .module('app')
  4. .component('post', {
  5. templateUrl: '/resources/post/post.component.html',
  6. controller: ['$scope', '$location', 'cms', function ($scope, $location, cms) {
  7. Object.assign($scope, { post: {}, })
  8. this.$routerOnActivate = function (next, previous) {
  9. cms.news.get({ id: next.params.id }).$promise.then(
  10. post => {
  11. console.log('post', post)
  12. $scope.post = post;
  13. },
  14. error => {
  15. console.log('news', error)
  16. }
  17. )
  18. };
  19. }]
  20. });