Modify Angular-Formly ngOptions outside of app -
we using angular-formly (angular 1.x , angular-formly 8.x) , trying modify our field's templateoptions->ngoptions
in our js outside of angular-formly app. doing because angular-formly app js cannot altered. "enhancements" must done externally. have tried using jquery modify our options not robust modifying underlying objects.
we have tried using following code no success:
var scopey = angular.element(jquery("[ng-app='formlyquestion'][ng-controller='mainctrl vm']")[0]).scope(); scopey.$apply(function(){ var scopey = angular.element(jquery("[ng-app='formlyquestion'][ng-controller='mainctrl vm']")[0]).scope(); scopey.vm.fields[2].templateoptions.ngoptions = "item.name item in [{\"name\":\"bachelor's\",\"value\":\"bachelor's\"},{\"name\":\"doctorate\",\"value\":\"doctorate\"},{\"name\":\"mister's\",\"value\":\"mister's\"}] track item.value";//scopey.vm.fields[2].templateoptions.ngoptions.replace(/doc/g, "ac"); });
attached plnkr link: http://plnkr.co/edit/tuwloonlalraiiccadt6?p=preview
thank time..
Comments
Post a Comment