0

So first of all, this works: (The html loads)

<div ng-include src="'start.html'"></div>

Here, the sideBar variable shows that the sideBar scope variable is equal to 'start.html' but when I insert it into the ng-include src - it does not work.

<div>{{ sideBar }}</div> <!-- sideBar appears on the page as start.html -->
<div ng-include src="'{{ sideBar }}'"></div> 

This also does not work:

<div ng-include src="{{ sideBar }}"></div>

and this does not work either:

<div ng-include src={{ sideBar }}></div>

only this works:

<div ng-include src="'start.html'"></div>

How can I make the include work with a scope variable?

2 Answers 2

3

Read documentation for ng-include.

Following works:

<div ng-include="sideBar"></div>
Sign up to request clarification or add additional context in comments.

Comments

0
<div ng-model="sideBar" ng-include src="sideBar"></div>

this works

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.