4
Angular JSコンポーネントで継承を達成するにはどうすればよいですか?私のサンプルは:Angular 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>