0
저는 AngularJS의 초보자입니다. 여기서 내가 뭘 잘못하고 있는지 모르는 것은 제 코드입니다. 기본적으로 내 index.html에서 post-id의 속성 값을 가져와 내 컨트롤러에서 콘솔로 인쇄하려고합니다. 내 index.html을에서AngularJS : 사용자 정의 태그에서 속성 값 가져 오기
:
<post-creator post-id="5" category="1"></post-creator>
<script src="components/post-creator/post-creator.component.js"></script>
후 creator.component.js :
이function controller($http) {
var model = this;
model.$onInit = function() {
console.log("id again:" + model.postId);
}
module.component("postCreator", {
templateUrl: "components/post-creator/post-creator.template.html",
bindings: {
value: "<"
},
controllerAs: "model",
controller: ["$http", controller]
});
이''postId' 대신 '값'의 포함 bindings'하지 않겠습니까? – tanmay
예를 들어 주시겠습니까? – MTA
답변으로 추가했습니다 .. – tanmay