Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS Loading a page into a div

Tags:

angularjs

I have a few static html pages of content. I want to make an index page that has two div's One for a sidebar menu and one to hold content. When one of the menu links in the sidebar is clicked I want to load one of the other static html pages into the content div.

I just cant find any documentation that shows how to do this, so i'm not even sure if it's possible. Can anyone help?

like image 307
PrestonDocks Avatar asked Jul 22 '13 12:07

PrestonDocks


2 Answers

You can also use ng-view to setup routes that will load your templates into your div. It's pretty straight forward, and there's a good example @ https://docs.angularjs.org/api/ngRoute/directive/ngView

like image 95
Mike Pugh Avatar answered Oct 20 '22 11:10

Mike Pugh


Use ng-include:

<ng-include
       src="{string}"
       [onload="{string}"]
       [autoscroll="{string}"]>
</ng-include>

http://docs.angularjs.org/api/ng.directive:ngInclude

like image 39
0xAX Avatar answered Oct 20 '22 11:10

0xAX