I am in search of a contextual state dropdown menu that is linked to the country, ensuring only relevant states are displayed.
I have explored these two solutions for guidance in my project.
Angularjs trigger country state dependency
angularjs dependant dropdown option value
However, I am facing difficulties in getting them to function and believe there may be something I am overlooking.
My ideal scenario would involve utilizing an existing ng filter, although it appears that this method is solely effective on arrays and not objects.
<select ng-model="user.state" ng-options="state.name for state in states track by state.id | filter:state.countryid = user.country.id">
I attempted converting the object into an array, but that approach did not yield successful results.
While I could develop a custom filter, I would prefer to avoid that route if possible.
<select ng-model="user.state" ng-options="state.name for state in states track by state.id | customStateFilter:user.country.id">
It seems like there must be a way to make ng-options work without altering the data directly.
Is there an Angular filter available that can manipulate objects, or is there a method to dynamically apply conditional logic to filter out objects?