简体   繁体   中英

ng-include don't include a partial view

i have a probleme with ng-include this code doesn't work and i don't find where is the error

<select name="select" id="select" class='input-large' ng-model="selectedbien">
                                        <option value='dz'>dz</option>
                                        <option value='fr'>fr</option>

                                        </select>

and <section ng-include src="partial/selectedbien.html"></section>

any help to find the problem please :)

It shall be

<section ng-include="'partial/selectedbien.html'"></section>

or

<ng-include src="'partial/selectedbien.html'"></ng-include>

Do not forget the quotes around URL - ng-include tries to interpret argument as angular.js expression, so you may change URL dynamically.

If you want to include your template directly then you need to add '' to your path like

src="'partial/selectedbien.html'"

It seems you are trying to add path dynamically from your dropdown selection then you need to concatenation your model with your path like

src="'partial/' + selectedbien + '.html'"

Check the Demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM