I want to use several constants directly in html (and few times in controllers).
For example, this is main app 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 this is 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 point is to keep all routes in one place.
So, can i do this, or may be i choosed wrong way?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…