Angularjs : $http load a page ng-repeat not working -
in sample.html -- > ng-repeat not working . seems angularjs couldn't compiler new page .
how add new page angular system ? or can make in other way ? please me .
myapp.controller('test' , function( $http , $scope ){ $scope.load = function( url ){ $http.get( url ).then( function( response ){ $scope.modalbody = response.data ; } ) ; } }) <div ng-controller="test"> {{ modalbody | trustedhtml }} <button ng-click="load( 'sample.html' )"></button> </div> in sample.html ↓↓↓↓↓↓↓↓ ng-repeat not working <div ng-repeat="x in [0,1,2,3,4]">{{x}}</div>
let angularjs load template url. directive ng-include handles you. interpolation doesn't compile html noticed.
myapp.controller('test' , function( $http , $scope ){ $scope.load = function( url ){ $scope.loadedurl = url; } }) <div ng-controller="test"> <div ng-include="loadedurl"></div> <button ng-click="load( 'sample.html' )"></button> </div> in sample.html ↓↓↓↓↓↓↓↓ ng-repeat not working <div ng-repeat="x in [0,1,2,3,4]">{{x}}</div>
Comments
Post a Comment