I have this piece of code
<select id="headers" ng-model="importHeader.systemHeaders">
<option ng-repeat="requiredHeaders in vCtrl.wizard.costs.headerData.headers" value="{{requiredHeaders}}" ng-selected="vCtrl.wizard.costs.changed(importHeader.headerName,requiredHeaders.displayName)">{{requiredHeaders.displayName}}
</option>
</select>
All i'm doing is looping through a set of headers and checks if the value of the imported Header is the same on what if required and it automatically selects it. It works fine, But my problem is that it won't add the systemHeaders
in my importHeaders
object declared on the ng-model
I need a way to trigger the change event of this select
. I know that when changing the seletion programmatically it won't trigger the ngChange
event.
i tried creating a function:
changed: function(val1,val2){
if (val1 == val2){
angular.element('#headers').change();
return true;
} else {
return false;
}
}
but it gets me an $apply is already in progress error.
Thanks in advance.