4
Angular JS 구성 요소를 사용하여 상속을 얻으려면 어떻게해야합니까? 내 샘플 :각도 JS 1.X 구성 요소 상속
app.component('ResourceForm', controller: [
function() {
this.save =() => {
$http(this.path, this.attributes());
};
},
]);
app.component('PersonForm', {
bindings: {
person: '<person',
},
controller: [
function() {
this.path = '/person/' + this.person.id;
this.attributes =() => { name: this.name };
},
],
});
<!-- templates/person_form.html -->
<form>
<input type="text" ng-model="$ctrl.name" >
<submit ng-click="$ctrl.save()"></submit>
</form>