Angular JS and partials Angular JS and partials angularjs angularjs

Angular JS and partials


Yes, you can do it using ngInclude directive.

See the docs and example here: https://docs.angularjs.org/api/ng/directive/ngInclude


@Wilt is right, but here is a more specific link and a code sample (from https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-view )

In your root template:

<div ui-view></div><div ui-view="chart"></div> <div ui-view="data"></div> 

And in your app.config function

$stateProvider.state("home", {    views: {        "": {            template: "<h1>Some HTML</h1>"        },        "chart": {            templateUrl: "templates/chart.html"        },        "data": {            template: "<data_thing/>"        }    }    })


If ng-include is not what you need, you might want to check out the angular-ui-router module. It allows you to do nested and parallel views... It is great, flexible, easy to use and well documented.https://github.com/angular-ui/ui-router