angularjs - How to use ng-include from code? -


i want use ng-include directive code.

var html = '<div ng-include="\'mytemplate.html\'"></div>'; $compile(html)($scope); angular.element(document.getelementbyid('mydiv')).append(html); 

but, 1 not working expected. can explain how achieve properly?

if want include html webpage, should use ng-bing-html instead :

html

<div id="mydiv" ng-bind-html="template"></div> 

js

.controller('name', function($scope, $http, $sce, ...) {     $http.get('mytemplate.html').success(function(template) {         $scope.template = $sce.trustashtml(template);     }); }); 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -