I have a form like below where i am loading an external template (sample.html) using ng-include ,
<div>
<form class="form-horizontal" ng-include src="'/src/sample.html'"></form>
</div>
<div>
<button type="submit" ng-click="submit()" translate>global.save</button>
</div>
My sample.html has few input fields. I have the same controller for both these files and i am loading the data for these files in that like below,
Restangular.one('fromAPIdata',id).get().then(function(data){
$scope.formData=data;
});
Now when i print $scope.formData in my form it is the same but when i print the same in sample.html most of the data are missing.
EDIT : And i came across an article about scope issues, that ng-include creates a new scope, StackOverflow Explanation
The problem solved when i used $parent.formData in my external template.
Is it possible to solve it in the controller instead of the template file. Any help will be great. Thanks in advance.