Angularjs 如何看nb模特儿?
我在控制器中使用ui select,我需要从控制器中侦听ng模型的更改,以下是我的HTML:Angularjs 如何看nb模特儿?,angularjs,angularjs-directive,angularjs-scope,ui-select,Angularjs,Angularjs Directive,Angularjs Scope,Ui Select,我在控制器中使用ui select,我需要从控制器中侦听ng模型的更改,以下是我的HTML: <div id="countryCtrl" country-selection class="form-inline"> <ui-select ng-model="selectedCountry" theme="selectize" style="{{$cat_style}}"> <ui-select-match placeholder="Sel
<div id="countryCtrl" country-selection class="form-inline">
<ui-select ng-model="selectedCountry" theme="selectize" style="{{$cat_style}}">
<ui-select-match placeholder="Select or search ...">
@{{$select.selected.title}}
</ui-select-match>
<ui-select-choices repeat="country in countries | filter: $select.search">
<span ng-bind-html="country.title | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
</div>
如果我在ui select指令中将国家/地区选择设置为如下属性,则可以使用watch:
<ui-select ng-model="selectedCountry" country-selection theme="selectize" style="{{$cat_style}}">
那么,我如何在ui中查看ng Model
属性,从父指令国家/地区选择
中选择指令?有一个属性,您可以从该属性调用作用域上的函数
<ui-select ng-model="person.selected" theme="select2" on-select="someFunction($item, $model)" ...
谢谢,这样我就不必看ng型号的变化了?我注意到您提到的示例将控制器用作app.controller('DemoCtrl',…我需要有一个独立的作用域,这不需要使用链接就可以吗?是的,我认为您可以预查找手表,并且可以有一个独立的作用域。如果该方法来自控制器,您可以将其传递给作用域为{methodName:'&}的指令,并在该指令上使用它。
Multiple directives [countrySelection, uiSelect] asking for new/isolated scope on:
<ui-select ng-model="person.selected" theme="select2" on-select="someFunction($item, $model)" ...