angularjs - Dynamically add directive on an element that doesnt exist yet -
i'm using this plugin bootstrap dropdown angularjs. issue i'm having code want looks to
<ol class="nya-bs-select" ng-model="city" name="city" required> <li nya-bs-option="city in subcities "> <a>{{ city.name }}</a> </li> </ol>
which generates like
<ol ng-model="city" class="nya-bs-select ng-pristine ng-untouched btn-group ng-invalid ng-invalid-required"> <button type="button" class="btn btn-default dropdown-toggle"><span class="pull-left filter-option">- select -</span> <span class="caret"></span></button> <div class="dropdown-menu open"> <ul class="dropdown-menu inner"> <li><a>- select -</a></li> <li nya-bs-option="city in subcities" class="ng-scope nya-bs-option"> <a tabindex="0" class="ng-binding">cityname</a> </li> </ul> </div> </ol>
as can see adds "button" element child of <ol>
. how can "listen" "nyabsselect" directive when creates <button>
element, want add ng-disabled
directive button's attribute?
you can add 1 more directive in same element nya-bs-select. directive can find button , add attribute. want add directive attribute might have $compile of button after adding attribute. can modify priority directive executes after plugin directive. have not looked plugin. guess modify plugin add 1 more attribute , ng disabled button , bind both.
Comments
Post a Comment