How is inheritance achieved using Angular JS components? My example:
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>
source
share