1
기본 구성 요소를 사용할 수 있지만 약속을 반환하는 $ http (users.get())를 통해 일부 데이터를로드하려고합니다 (데이터가 console.log (this.data)에 표시됩니다.)하지만 데이터가(1.5) 각 구성 요소에 데이터를로드하는 방법은 무엇입니까?
.component('mrcUserInfo', {
bindings: {
email: '<',
first_name: '<',
last_name: '<'
},
templateUrl: 'components/userInfo.html',
controller: function(users) {
var scope = {};
scope.thisId = 1;
this.miketest = 'this is miketest';
users.get(scope) // basically does a $http()...
.then(function(data) {
this.data = data.data;
this.email = data.email;
this.miketest = 'this is mike 2';
console.log('user?');
console.log(this.data);
});
}
왜?. 구성 요소 템플릿을 제작하지 않습니다 그리고 내 템플릿이
this is userInfo.html:
{{ $ctrl.miketest }}
템플릿 표시 '이 miketest이다'하지만이 마이크 2 '표시하지 않습니다있다 '
감사의 말씀 감사합니다. 마이크
그게 고마워! –