EVOLUTION-MANAGER
Edit File: ngView.html
<a href='https://github.com/angular/angular.js/edit/v1.3.x/src/ngRoute/directive/ngView.js?message=docs(ngView)%3A%20describe%20your%20change...#L7' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit"> </i>Improve this Doc</a> <a href='https://github.com/angular/angular.js/tree/v1.3.9/src/ngRoute/directive/ngView.js#L7' class='view-source pull-right btn btn-primary'> <i class="glyphicon glyphicon-zoom-in"> </i>View Source </a> <header class="api-profile-header"> <h1 class="api-profile-header-heading">ngView</h1> <ol class="api-profile-header-structure naked-list step-list"> <li> - directive in module <a href="api/ngRoute">ngRoute</a> </li> </ol> </header> <div class="api-profile-description"> <h1 id="overview">Overview</h1> <p><code>ngView</code> is a directive that complements the <a href="api/ngRoute/service/$route">$route</a> service by including the rendered template of the current route into the main layout (<code>index.html</code>) file. Every time the current route changes, the included view changes with it according to the configuration of the <code>$route</code> service.</p> <p>Requires the <a href="api/ngRoute"><code>ngRoute</code></a> module to be installed.</p> </div> <div> <h2>Directive Info</h2> <ul> <li>This directive creates new scope.</li> <li>This directive executes at priority level 400.</li> </ul> <h2 id="usage">Usage</h2> <div class="usage"> <ul> <li>as element: (This directive can be used as custom element, but be aware of <a href="guide/ie">IE restrictions</a>). <pre><code><ng-view [onload=""] [autoscroll=""]> ... </ng-view></code></pre> </li> <li>as attribute: <pre><code><ANY [onload=""] [autoscroll=""]> ... </ANY></code></pre> </li> <li>as CSS class: <pre><code><ANY class="[onload: ;] [autoscroll: ;]"> ... </ANY></code></pre> </li> </div> <h2 id="animations">Animations</h2> <p>enter - animation is used to bring new content into the browser. leave - animation is used to animate existing content away.</p> <p>The enter and leave animation occur concurrently.</p> <a href="api/ngAnimate/service/$animate">Click here</a> to learn more about the steps involved in the animation. <section class="api-section"> <h3>Arguments</h3> <table class="variables-matrix input-arguments"> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td> onload <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Expression to evaluate whenever the view updates.</p> </td> </tr> <tr> <td> autoscroll <div><em>(optional)</em></div> </td> <td> <a href="" class="label type-hint type-hint-string">string</a> </td> <td> <p>Whether <code>ngView</code> should call <a href="api/ng/service/$anchorScroll">$anchorScroll</a> to scroll the viewport after the view is updated.</p> <pre><code>- If the attribute is not set, disable scrolling. - If the attribute is set without value, enable scrolling. - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated as an expression yields a truthy value. </code></pre> </td> </tr> </tbody> </table> </section> <h2>Events</h2> <ul class="events"> <li id="$viewContentLoaded"> <h3>$viewContentLoaded</h3> <div><p>Emitted every time the ngView content is reloaded.</p> </div> <div class="inline"> <h4>Type:</h4> <div class="type">emit</div> </div> <div class="inline"> <h4>Target:</h4> <div class="target">the current ngView scope</div> </div> </li> </ul> <h2 id="example">Example</h2><p> <div> <a ng-click="openPlunkr('examples/example-ngView-directive')" class="btn pull-right"> <i class="glyphicon glyphicon-edit"> </i> Edit in Plunker</a> <div class="runnable-example" path="examples/example-ngView-directive" name="ngView-directive" module="ngViewExample" deps="angular-route.js;angular-animate.js" animations="true" fixBase="true"> <div class="runnable-example-file" name="index.html" language="html" type="html"> <pre><code><div ng-controller="MainCtrl as main"> Choose: <a href="Book/Moby">Moby</a> | <a href="Book/Moby/ch/1">Moby: Ch1</a> | <a href="Book/Gatsby">Gatsby</a> | <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> | <a href="Book/Scarlet">Scarlet Letter</a><br/> <div class="view-animate-container"> <div ng-view class="view-animate"></div> </div> <hr /> <pre>$location.path() = {{main.$location.path()}}</pre> <pre>$route.current.templateUrl = {{main.$route.current.templateUrl}}</pre> <pre>$route.current.params = {{main.$route.current.params}}</pre> <pre>$routeParams = {{main.$routeParams}}</pre> </div></code></pre> </div> <div class="runnable-example-file" name="book.html" language="html" type="html"> <pre><code><div> controller: {{book.name}}<br /> Book Id: {{book.params.bookId}}<br /> </div></code></pre> </div> <div class="runnable-example-file" name="chapter.html" language="html" type="html"> <pre><code><div> controller: {{chapter.name}}<br /> Book Id: {{chapter.params.bookId}}<br /> Chapter Id: {{chapter.params.chapterId}} </div></code></pre> </div> <div class="runnable-example-file" name="animations.css" language="css" type="css"> <pre><code>.view-animate-container { position:relative; height:100px!important; background:white; border:1px solid black; height:40px; overflow:hidden; } .view-animate { padding:10px; } .view-animate.ng-enter, .view-animate.ng-leave { -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; display:block; width:100%; border-left:1px solid black; position:absolute; top:0; left:0; right:0; bottom:0; padding:10px; } .view-animate.ng-enter { left:100%; } .view-animate.ng-enter.ng-enter-active { left:0; } .view-animate.ng-leave.ng-leave-active { left:-100%; }</code></pre> </div> <div class="runnable-example-file" name="script.js" language="js" type="js"> <pre><code>angular.module('ngViewExample', ['ngRoute', 'ngAnimate']) .config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $routeProvider .when('/Book/:bookId', { templateUrl: 'book.html', controller: 'BookCtrl', controllerAs: 'book' }) .when('/Book/:bookId/ch/:chapterId', { templateUrl: 'chapter.html', controller: 'ChapterCtrl', controllerAs: 'chapter' }); $locationProvider.html5Mode(true); }]) .controller('MainCtrl', ['$route', '$routeParams', '$location', function($route, $routeParams, $location) { this.$route = $route; this.$location = $location; this.$routeParams = $routeParams; }]) .controller('BookCtrl', ['$routeParams', function($routeParams) { this.name = "BookCtrl"; this.params = $routeParams; }]) .controller('ChapterCtrl', ['$routeParams', function($routeParams) { this.name = "ChapterCtrl"; this.params = $routeParams; }]);</code></pre> </div> <div class="runnable-example-file" name="protractor.js" type="protractor" language="js"> <pre><code>it('should load and compile correct template', function() { element(by.linkText('Moby: Ch1')).click(); var content = element(by.css('[ng-view]')).getText(); expect(content).toMatch(/controller\: ChapterCtrl/); expect(content).toMatch(/Book Id\: Moby/); expect(content).toMatch(/Chapter Id\: 1/); element(by.partialLinkText('Scarlet')).click(); content = element(by.css('[ng-view]')).getText(); expect(content).toMatch(/controller\: BookCtrl/); expect(content).toMatch(/Book Id\: Scarlet/); });</code></pre> </div> <iframe class="runnable-example-frame" src="examples/example-ngView-directive/index.html" name="example-ngView-directive"></iframe> </div> </div> </p> </div>