/app/assets/javascripts/components/taskList.coffee angular.module('app').component 'taskList', templateUrl: 'taskList.html' controller: 'TaskCtrl' bindings: project: '=' /app/assets/javascripts/controllers/comment.coffee angular.module('app').controller 'TaskCtrl', [ '$scope', 'TaskResource' , ($scope, TaskResource) -> console.log this.project # есть this.something_this = "something" $scope.something_scope = "something" ] /app/assets/javascripts/templates/projectList.html.slim task-list [project="project"] /app/assets/javascripts/templates/taskList.html.slim .task-controller p {{ $ctrl.project.id }} // есть p {{ $ctrl.something_this }} //пусто, почему? p {{ something_scope }} // есть 

The same problem persists if the controller is attached to the view directly via the ng-controller

  • Can you make a minimal reproducible example so that you can run and see? - Grundy
  • @Grundy, did , apparently this happens only on my car , I can not understand why - srghma
  • So you need to add an example more code from the option where it does not work. Perhaps something can rewrite this field, or the view takes place in another component - Grundy
  • @Grundy, I understood, wrote in the answer, it's just lol, can you explain? before there was no such thing - srghma
  • and return to what function? - Grundy

1 answer 1

 # правильный вариант angular.module('app').controller 'TaskCtrl', [ '$scope', 'TaskResource' , ($scope, TaskResource) -> console.log this.project this.something_this = "something" $scope.something_scope = "something" this.setDeadline = (task, date) -> # вот здесь будет вставлен return this.setDeadline, что все и ломает, почему? TaskResource.deadline({ id: task.id }, { deadline: date }).$promise.then (response) -> task.deadline = response.deadline .catch (response) -> task.deadline = null return # раньше return не было ]