Directive
ng-include creates a new child object. here doc
when your model in ng-include html as <select ng-model="list" ng-change="changeInsideTemplate()"> and then angular will check the list model in its child area, then angular will understand that there is no list in model in ng-include child reach. then angular will create a new child model called list inside the content area.
if u really like
<select ng-model="$parent.list" ng-change="changeInsideTemplate()">
then angular will check the list model in the parent scope. in the parent area, ng-include scope contains the $scope.list that we $scope.list to.
Plunker works here
OR you can use as shown below as @dfsq in the comment.
controller
app.controller('MainCtrl', function($scope) { $scope.name = 'World'; $scope.test = "test.html"; $scope.list = {value: 'a'}; $scope.changeInsideTemplate = function() { console.log($scope.list.value);
index.html
<select ng-model="list.value" ng-change="changeOutsideTemplate()">
test.html
<select ng-model="list.value" ng-change="changeInsideTemplate()">
in test.html angular will check for list.value , then angular will know that value is a property of the object, and there is no object named list in the child scope. then angular will look for the object ( list ) in the parent scope, since it will look for the entire hierarchy.
here plunker
if you have ng-include inside ng-include and then the second ng-include create a child area on the first ng-include
then in test.html
<div ng-include="$parent.include"></div> // because `$scope.include` in parent scope
and in include.html
<select ng-model="$parent.$parent.list" ng-change="otherChanging()"> // because `$scope.list` is in parent scope of parent scope (second upper parent scope).
here is Plunker using $ parent.
here is Plunker using Object.
use of the object is more suitable.