Answer the question
In order to leave comments, you need to log in
Question about application architecture and ngRoute?
Hello. I will try to briefly describe the essence of my problem. Here is the code:
<body ng-app="Arenda" ng-controller="RootController">
<nav></nav>
<div ng-if="bgPageHeaderEnabled" ng-include=""ng_templates/bg-pageheader.html""></div>
<div class="container" ng-view>
</body>
app = angular.module "Arenda", ['ngMaterial', 'ngRoute'] # module init
`
app.config ($routeProvider) ->
$routeProvider
.when '/',
controller: 'RoomController'
templateUrl: 'ng_templates/rooms.html'
.when '/room/:id',
controller: 'PhotoController',
templateUrl: 'views/photo.html'
.otherwise
redirectTo: '/'
return
app.controller "RootController", ['$scope', '$http', ($scope, $http) ->
$scope.bgPageHeaderEnabled = true;
]
Answer the question
In order to leave comments, you need to log in
I don’t know about the default router, but ui-router (defacto in angular) has such a feature as resolve. https://github.com/angular-ui/ui-router/wiki#resolve
It allows you to pass the necessary parameters to the state through dependency injection.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question