I can't change ngModel defined in $ctrl. It looks like this: 1. I have next code, defining component in index.html:
<div ng-controller="appControllerData">
...
<div ng-controller="appControllerData as datactrl">
<filter-userstat userstat="'isPolicyHolder'"></filter-userstat>
</div>
...
</div>
2. I have component file (filter_userstat.html):
<div>
<input type="checkbox" value="true" ng-model="$ctrl.usersFilter[$ctrl.userstat]"> Some value
</div>
3. I have a component (filter_userstat.js):
appModule.component('filterUserstat', {
templateUrl: 'filter_userstat.html',
controller: filterUserstatController,
bindings: {
userstat: '<'
// , usersFilter: '<' // I tried everything without any success
}
});
function filterUserstatController(){
// ...
}
I have usersFilter in my controller:
this.usersFilter = $scope.usersFilter = { .... };
When I click on the checkbox it seems doesn't affect on the parent's model, whatever I did. However if I relocate this code in the index.html as was set before, everything works just perfect. So as I can conclude it is needed to link the parent ngModel with the one in the component. But I can't find out the way yet. Has anybody suggestion?