In my AngularJS view, I have a dropdown that triggers a function when the color is changed:
<select ng-change="shop.updateSizes()" ng-model="shop.color" ng-options="color.name for color in COLORS"></select>
The updateSizes method in my controller is responsible for updating sizes based on the selected color:
shop.updateSizes = function () {
this.sizes = this.color.sizes;
this.updateSomethingElse(); //*
return this;
}
I'm looking for guidance on how to initially set the color and have the updateSizes function trigger.
Additionally, I'm curious if the line labeled with a * follows best practices. Alternatively, I could add a listener in the controller object for sizes changes to call updateSomethingElse().