@@ -53,48 +53,46 @@ part of angular.routing;
5353 */
5454@Decorator (
5555 selector: 'ng-view' ,
56- module: NgView .module,
57- visibility: Directive .CHILDREN_VISIBILITY )
56+ module: NgView .module)
5857class NgView implements DetachAware , RouteProvider {
5958 static final Module _module = new Module ()
6059 ..bind (RouteProvider , toFactory: (i) => i.get (NgView ));
61- static module () => _module;
6260
63- final NgRoutingHelper locationService;
64- final ViewCache viewCache;
65- final Injector injector;
66- final Element element;
67- final Scope scope;
61+ static Module module () => _module;
62+
63+ final NgRoutingHelper _locationService;
64+ final ViewCache _viewCache;
65+ final Injector _injector;
66+ final Element _element;
67+ final Scope _scope;
6868 RouteHandle _route;
6969
7070 View _view;
71- Scope _scope ;
71+ Scope _childScope ;
7272 Route _viewRoute;
7373
74- NgView (this .element, this .viewCache,
75- Injector injector, Router router,
76- this .scope)
77- : injector = injector,
78- locationService = injector.get (NgRoutingHelper )
74+ NgView (this ._element, this ._viewCache, Injector injector, Router router, this ._scope)
75+ : _injector = injector,
76+ _locationService = injector.get (NgRoutingHelper )
7977 {
8078 RouteProvider routeProvider = injector.parent.get (NgView );
8179 _route = routeProvider != null ?
8280 routeProvider.route.newHandle () :
8381 router.root.newHandle ();
84- locationService ._registerPortal (this );
82+ _locationService ._registerPortal (this );
8583 _maybeReloadViews ();
8684 }
8785
8886 void _maybeReloadViews () {
89- if (_route.isActive) locationService ._reloadViews (startingFrom: _route);
87+ if (_route.isActive) _locationService ._reloadViews (startingFrom: _route);
9088 }
9189
92- detach () {
90+ void detach () {
9391 _route.discard ();
94- locationService ._unregisterPortal (this );
92+ _locationService ._unregisterPortal (this );
9593 }
9694
97- _show (_View viewDef, Route route, List <Module > modules) {
95+ void _show (_View viewDef, Route route, List <Module > modules) {
9896 assert (route.isActive);
9997
10098 if (_viewRoute != null ) return ;
@@ -109,34 +107,36 @@ class NgView implements DetachAware, RouteProvider {
109107 });
110108
111109 var viewInjector = modules == null ?
112- injector :
113- forceNewDirectivesAndFormatters (injector , modules);
110+ _injector :
111+ forceNewDirectivesAndFormatters (_injector , modules);
114112
115113 var newDirectives = viewInjector.get (DirectiveMap );
116114 var viewFuture = viewDef.templateHtml != null ?
117- new Future .value (viewCache .fromHtml (viewDef.templateHtml, newDirectives)) :
118- viewCache .fromUrl (viewDef.template, newDirectives);
115+ new Future .value (_viewCache .fromHtml (viewDef.templateHtml, newDirectives)) :
116+ _viewCache .fromUrl (viewDef.template, newDirectives);
119117 viewFuture.then ((viewFactory) {
120118 _cleanUp ();
121- _scope = scope .createChild (new PrototypeMap (scope .context));
119+ _childScope = _scope .createChild (new PrototypeMap (_scope .context));
122120 _view = viewFactory (
123- viewInjector.createChild ([new Module ()..bind (Scope , toValue: _scope )]));
124- _view.nodes.forEach ((elm) => element .append (elm));
121+ viewInjector.createChild ([new Module ()..bind (Scope , toValue: _childScope )]));
122+ _view.nodes.forEach ((elm) => _element .append (elm));
125123 });
126124 }
127125
128- _cleanUp () {
126+ void _cleanUp () {
129127 if (_view == null ) return ;
130128
131129 _view.nodes.forEach ((node) => node.remove ());
132- _scope .destroy ();
130+ _childScope .destroy ();
133131
134132 _view = null ;
135- _scope = null ;
133+ _childScope = null ;
136134 }
137135
138136 Route get route => _viewRoute;
137+
139138 String get routeName => _viewRoute.name;
139+
140140 Map <String , String > get parameters {
141141 var res = < String , String > {};
142142 var p = _viewRoute;
0 commit comments