|
111 | 111 | * <ui-view autoscroll='scopeVariable'/> |
112 | 112 | * </pre> |
113 | 113 | */ |
114 | | -$ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll']; |
115 | | -function $ViewDirective( $state, $injector, $uiViewScroll) { |
| 114 | +$ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll', '$interpolate']; |
| 115 | +function $ViewDirective( $state, $injector, $uiViewScroll, $interpolate) { |
116 | 116 |
|
117 | 117 | function getService() { |
118 | 118 | return ($injector.has) ? function(service) { |
@@ -209,7 +209,7 @@ function $ViewDirective( $state, $injector, $uiViewScroll) { |
209 | 209 |
|
210 | 210 | function updateView(firstTime) { |
211 | 211 | var newScope, |
212 | | - name = getUiViewName(attrs, $element.inheritedData('$uiView')), |
| 212 | + name = getUiViewName(scope, attrs, $element, $interpolate), |
213 | 213 | previousLocals = name && $state.$current && $state.$current.locals[name]; |
214 | 214 |
|
215 | 215 | if (!firstTime && previousLocals === latestLocals) return; // nothing to do |
@@ -251,16 +251,16 @@ function $ViewDirective( $state, $injector, $uiViewScroll) { |
251 | 251 | return directive; |
252 | 252 | } |
253 | 253 |
|
254 | | -$ViewDirectiveFill.$inject = ['$compile', '$controller', '$state']; |
255 | | -function $ViewDirectiveFill ($compile, $controller, $state) { |
| 254 | +$ViewDirectiveFill.$inject = ['$compile', '$controller', '$state', '$interpolate']; |
| 255 | +function $ViewDirectiveFill ( $compile, $controller, $state, $interpolate) { |
256 | 256 | return { |
257 | 257 | restrict: 'ECA', |
258 | 258 | priority: -400, |
259 | 259 | compile: function (tElement) { |
260 | 260 | var initial = tElement.html(); |
261 | 261 | return function (scope, $element, attrs) { |
262 | 262 | var current = $state.$current, |
263 | | - name = getUiViewName(attrs, $element.inheritedData('$uiView')), |
| 263 | + name = getUiViewName(scope, attrs, $element, $interpolate), |
264 | 264 | locals = current && current.locals[name]; |
265 | 265 |
|
266 | 266 | if (! locals) { |
@@ -290,10 +290,11 @@ function $ViewDirectiveFill ($compile, $controller, $state) { |
290 | 290 |
|
291 | 291 | /** |
292 | 292 | * Shared ui-view code for both directives: |
293 | | - * Given attributes and inherited $uiView data, return the view's name |
| 293 | + * Given scope, element, and its attributes, return the view's name |
294 | 294 | */ |
295 | | -function getUiViewName(attrs, inherited) { |
296 | | - var name = attrs.uiView || attrs.name || ''; |
| 295 | +function getUiViewName(scope, attrs, element, $interpolate) { |
| 296 | + var name = $interpolate(attrs.uiView || attrs.name || '')(scope); |
| 297 | + var inherited = element.inheritedData('$uiView'); |
297 | 298 | return name.indexOf('@') >= 0 ? name : (name + '@' + (inherited ? inherited.state.name : '')); |
298 | 299 | } |
299 | 300 |
|
|
0 commit comments