My angular project's path is like this
web
server.py ##flask server program
app
static
app.js
controllers.js
etc...
templates
index.html
home.html
index.html
<!-- this didn't work -->
<ng-include src="templates/home.html"><ng-include>
<!-- nor did this -->
<ng-include src="home.html"></ng-include>
home.html
<h1> home! </h1>
Except I don't see the partial (home.html) in my output.
Anyone see my mistake?
The ng-include directive includes HTML from an external file. The included content will be included as childnodes of the specified element. The value of the ng-include attribute can also be an expression, returning a filename. By default, the included file must be located on the same domain as the document.
The primary purpose of the ng-include directive is used to fetch, compile, and include an external HTML file in the main AngularJS application. These are added as child nodes in the main application. The ng-include attribute's value can also be an expression, that returns a filename.
ngInclude creates a new child scope which inherits scope values from the parent controller.
A file path describes the location of a file in a web site's folder structure. File paths are used when linking to external files, like: Web pages. Images.
The src attribute of ng-include expects a string. Either you pass a scope variable, or pass string directly.
<ng-include src=" 'templates/home.html' "></ng-include>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With