小时候怎么看nb-Model?

How to watch nb-Model at child?

我在控制器中使用 ui-select,我需要从控制器监听 ng-model 的变化,这是我的 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>

在国内选择控制器:

angular.module('mainCtrl').directive('countrySelection', ['Country','state', function(Country, state) {


var linkF = function (scope, element, attrs, widgetPath) {

        scope.$watch("selectedCountry", function (neww, old) {

            console.log(scope.selectedCountry);
            widgetPath.selectedCountry= widgetPath.model.selectedCountry;
            scope.update("state.country.changed",scope.selectedCountry);//widgetPath.model.selectedCountry);

        }, true);



    };


    return {

        require: "^widgetPath",
        restrict: 'A',
        link: linkF,
        scope: {}
    }

}]);
如果我在 ui-select 指令中将 country-selection 设置为这样的属性,

watch 将起作用:

<ui-select  ng-model="selectedCountry" country-selection theme="selectize" style="{{$cat_style}}">

但是,然后,我将无法隔离 country-selection 的范围,我会得到错误

Multiple directives [countrySelection, uiSelect] asking for new/isolated scope on: 

那么,我如何从父指令 country-selection 查看 ui-select 指令中的 ng-Model 属性?

有一个 on-select 属性,您可以从那里调用作用域上的函数。

<ui-select ng-model="person.selected" theme="select2" on-select="someFunction($item, $model)" ...