Routing

To create new routes, add the paths you want to handle in your app.ts:

import { routes } from ‘entcore’;

routes.define(function(\$routeProvider){
    $routeProvider
        .when(‘my/route’, {
            action: 'actionName'
        })
});

All controllers can then use the action to determine their behaviour on route change:

export const myNewController = ng.controller(‘MyNewController’, [‘$scope’, ‘route’,
($scope, route) => {
    route({
        actionName: async () => {
            await someAsyncMethodDefinedElsewhere();
            template.open(‘myContainer’, ‘myTemplate’);
            $scope.$apply();
        }
    });
}]);

results matching ""

    No results matching ""