Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何看nb模特儿?_Angularjs_Angularjs Directive_Angularjs Scope_Ui Select - Fatal编程技术网

Angularjs 如何看nb模特儿?

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

我在控制器中使用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="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)" ...