|
6 | 6 | import {ReflectorReader, reflector} from '../private_import_core';
|
7 | 7 |
|
8 | 8 | import {
|
9 |
| - UIRouter, isFunction, Transition, parse, HookResult, TransitionHookFn, State, prop, StateDeclaration |
| 9 | + UIRouter, isFunction, Transition, parse, HookResult, TransitionHookFn, State, prop, StateDeclaration, inArray |
10 | 10 | } from "ui-router-core";
|
11 | 11 | import {trace} from "ui-router-core";
|
12 | 12 | import {ViewContext, ViewConfig, ActiveUIView} from "ui-router-core";
|
@@ -283,15 +283,22 @@ export class UIView {
|
283 | 283 | */
|
284 | 284 | applyInputBindings(ref: ComponentRef<any>, context: ResolveContext, componentClass) {
|
285 | 285 | let bindings = this.uiViewData.config.viewDecl['bindings'] || {};
|
| 286 | + let explicitBoundProps = Object.keys(bindings); |
286 | 287 |
|
287 |
| - var addResolvable = (tuple: InputMapping) => ({ |
| 288 | + // Supply resolve data to matching @Input('prop') or inputs: ['prop'] |
| 289 | + let explicitInputTuples = explicitBoundProps |
| 290 | + .reduce((acc, key) => acc.concat([{ prop: key, token: bindings[key] }]), []); |
| 291 | + let implicitInputTuples = ng2ComponentInputs(componentClass) |
| 292 | + .filter(tuple => !inArray(explicitBoundProps, tuple.prop)); |
| 293 | + |
| 294 | + |
| 295 | + const addResolvable = (tuple: InputMapping) => ({ |
288 | 296 | prop: tuple.prop,
|
289 |
| - resolvable: context.getResolvable(bindings[tuple.prop] || tuple.token) |
| 297 | + resolvable: context.getResolvable(tuple.token), |
290 | 298 | });
|
291 | 299 |
|
292 |
| - // Supply resolve data to matching @Input('prop') or inputs: ['prop'] |
293 |
| - let inputTuples = ng2ComponentInputs(componentClass); |
294 |
| - inputTuples.map(addResolvable) |
| 300 | + explicitInputTuples.concat(implicitInputTuples) |
| 301 | + .map(addResolvable) |
295 | 302 | .filter(tuple => tuple.resolvable && tuple.resolvable.resolved)
|
296 | 303 | .forEach(tuple => { ref.instance[tuple.prop] = tuple.resolvable.data });
|
297 | 304 |
|
|
0 commit comments