Skip to content

Routing doesn't work #2

@palenshus

Description

@palenshus

In main.ts:28, the code attempts to get the state.component.selector property, which doesn't (any longer?) exist. I worked around this by doing the following, but it sure would be nice if the workaround wasn't needed. (And save people a LOT of hours!)

import "reflect-metadata";
...
export interface IComponentState extends ng.ui.IState {
    componentClass: any;
}
...
const routes: IComponentState[] = [
    { name: "home", url: "/", componentClass: RootComponent }
];
...
    private static provideStates(states: IComponentState[], $stateProvider: ng.ui.IStateProvider) {
        states.map((config) => {

            // Set component name by reflecting metadata from component's @Component decorator
            const componentName = Reflect.getMetadata("custom:name", config.componentClass);
            config.component = componentName;
            delete config.componentClass;

            return { name: config.name, config };
        }).forEach(state => $stateProvider.state(state.name, state.config));
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions