Thursday, 15 January 2015

angularjs - How to change a div when a link is clicked and show its content -



angularjs - How to change a div when a link is clicked and show its content -

i need alter div in page , alter content of div when link clicked.i want angularjs.for illustration have 3 links view1 view2 , view3.these 3 links inked in 3 html files view1.html,view2.html , view3.html contain different contents in each of files.

when click link view1 need load view1.html page content in div.(dynamically load without changing other content in page)and when view2 clicked view2.html clicked should loaded in div.how can it?if utilize ng-view load whole page.do need utilize ng-click?if how can it?please explain..do need controllers?if give me illustration :(

you can utilize ng-include please see demo here http://plnkr.co/edit/fliimjz6gjvqjpu7swrd?p=preview

<a href="" ng-click="template='view1.html'">view 1</a> <a href="" ng-click="template='view2.html'">view 2</a> <a href="" ng-click="template='view3.html'">view 3</a> <div ng-include="template"></div>

angularjs angularjs-directive angularjs-scope

No comments:

Post a Comment