ngRoute.ngView (directive)

Improve this Doc View Source ngView

  1. directive in module ngRoute

Overview

ngView is a directive that complements the $route service by including the rendered template of the current route into the main layout (index.html) file. Every time the current route changes, the included view changes with it according to the configuration of the $route service.

Requires the ngRoute module to be installed.

Directive Info

  • This directive creates new scope.
  • This directive executes at priority level 400.

Usage

  • as element: (This directive can be used as custom element, but be aware of IE restrictions).
    <ng-view
      [onload=""]
      [autoscroll=""]>
    ...
    </ng-view>
  • as attribute:
    <ANY
      [onload=""]
      [autoscroll=""]>
    ...
    </ANY>
  • as CSS class:
    <ANY class="[onload: ;] [autoscroll: ;]"> ... </ANY>

Animations

enter - animation is used to bring new content into the browser. leave - animation is used to animate existing content away.

The enter and leave animation occur concurrently.

Click here to learn more about the steps involved in the animation.

Arguments

Param Type Details
onload
(optional)
string

Expression to evaluate whenever the view updates.

autoscroll
(optional)
string

Whether ngView should call $anchorScroll to scroll the viewport after the view is updated.

- 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.

Events

  • $viewContentLoaded

    Emitted every time the ngView content is reloaded.

    Type:

    emit

    Target:

    the current ngView scope

© 2010–2016 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://code.angularjs.org/1.2.32/docs/api/ngRoute/directive/ngView

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部