좋은 아침 내가 작은 문제가 bindigs 내가 지시가 :액세스
return {
restrict:'E',
scope: {
user: "="
},
template: '<b>{{userLogin}}</b>',
link:function(scope,elem,attrs){
},
controller: function ($scope) {
console.log($scope.user)//always undefindet
$scope.userLogin = $scope.user;
},
};
그리고 난 템플릿 내가 있기 때문에 컨트롤러를 사용해야의 범위 내 매개 변수 "사용자"를 표시하려면
scope: {
user: "=" //when i have this response "undefined"
user: "@" //when i have this response not show id only text
},
내 HTML
<get-user-login user="{{post.user_id}}"></get-user-login>
: 나는 문제가 (지시어에) 여기 어딘가에 생각 서버 에서 일부 데이터를 다운로드해야합니다
나는 항상 : 콘솔에서 빈 값 또는 정의되지 않음을 얻습니다. 해결 방법. @
을 사용하는 경우
을 통해 이동 (http://stackoverflow.com/questions/ : getPost 당신이 $ scope.onePost에 결합하고 있기 때문에, 그래서 아마 올바른 방법입니다 14050195/what-is-the-difference-in-directive-scope-in-angularjs? rq = 1) –