Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
33
rated 0 times [  35] [ 2]  / answers: 1 / hits: 19759  / 9 Years ago, wed, april 8, 2015, 12:00:00

Here is a source of the main.html file



<!DOCTYPE html>
<html>
<head>
<script src=http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js></script>

<script>
var myApp = angular.module ('myApp',[]);
myApp.controller('myCtrl', function ($scope){
$scope.name = Tim;
$scope.partialStuff = [ 'a', 'b', 'c' ];
alert(window.angular.version.full);//1.3.14 is displayed
});
</script>
</head>
<body ng-app=myApp>
<div ng-controller=myCtrl>
{{name}}
<div ng-repeat=partialVar in partialStuff>
Hello: <div ng-include src='part.html'></div>
</div>
</div>
</body>
</html>


Also there is a part.html that contains a plain text 'part' - just several symbols.



Both files main.html and part.html are located in the same folder.



When I open main.html in the browser, I don't see three repeats of the content from part.html however I see three Hello:. Seems like part.html is not loaded.



Why?



Thank you.



Please place it within the body tag to make it work



<script type=text/ng-template id=part.html>
part
</script>

More From » html

 Answers
18

You cannot import local files directly using the file:// protocol.



You should take a look at:
Is it possible to use ng-include without web server?


[#67146] Tuesday, April 7, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jenna

Total Points: 706
Total Questions: 107
Total Answers: 106

Location: Azerbaijan
Member since Tue, Sep 21, 2021
3 Years ago
;