I want to use several constants directly in HTML (and several times in controllers).
For example, this is the main application module:
angular.module('website', []) .constant('ROUTES', (function () { return { SIGN_IN: '/sign/in' } })()) .config([..., 'ROUTES', function(..., ROUTES { $routeProvider.when(ROUTES.SIGN_IN, {templateUrl: 'pages/sign_in.html', controller: 'SignInController'}); }]);
So, itβs clear how to use constants from controllers.
But how can I do something like this:
<html ng-app="website"> <body> <a href="{{ROUTES.SIGN_IN}}">Sign in</a> </body> </html>
The bottom line is to store all the routes in one place. So can I do this, or have I chosen the wrong path?
javascript angularjs
Sergei Panfilov Jul 6 '13 at 17:03 2013-07-06 17:03
source share