Currently, I am developing a component within my Angular application where I am binding an object:
CustomComponent.js
angular.module("app").component( "customComponent", {
controller: function() {
var ctrl = this;
ctrl.createInstance = function() {
ctrl.binding = new Object();
}
},
bindings: {
binding: "="
},
templateUrl: "customComponent.html"
});
MainApp.html
<div ng-repeat="item in CustomObject.items">
<customComponent binding="item"></customComponent>
</div>
If I call the createInstance()
function within my custom component, would it result in unbinding the object? If so, what is the best way to maintain the binding while creating a new instance of an object?