Answer the question
In order to leave comments, you need to log in
UIRouter and LazyLoad controllers?
I'm trying to load the controller needed for it every time the page is loaded via LazyLoad. My code:
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body ng-app="Arenda" ng-controller="RootController">
<div ui-view="navBar" class="animate-hide" ng-hide="navBarHide"></div>
<div ui-view="bgPageHeader" class="animate-if" ng-hide="bgPageHeaderHide"></div>
<div ui-view></div>
<script src=bower_components/jquery/dist/jquery.min.js></script>
<!-- angularjs -->
<script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.min.js"></script>
<script src="bower_components/angular-animate/angular-animate.min.js"></script>
<script src="bower_components/angular-aria/angular-aria.min.js"></script>
<script src="bower_components/angular-messages/angular-messages.min.js"></script>
<!-- ui-router -->
<script src="bower_components/angular-ui-router/release/angular-ui-router.min.js"></script>
<!-- ocLazyLoad -->
<script src="bower_components/oclazyload/dist/ocLazyLoad.min.js"></script>
<!-- angular material -->
<script src="bower_components/angular-material/angular-material.min.js"></script>
<!-- app -->
<script src="js/angular/init.js"></script>
<script src="js/angular/states.js"></script>
<script src="js/angular/ocLazyLoad.js"></script>
</body>
</html>
app = angular.module "Arenda", [
'ngMaterial'
'ui.router'
'oc.lazyLoad'
'ngSanitize'
'ngAnimate'
] # module init
app.run [
'$rootScope'
($rootScope) ->
# some code here
app.
config [ # config
'$stateProvider'
'$urlRouterProvider'
($stateProvider, $urlRouterProvider) ->
$urlRouterProvider
.otherwise '/' # редирект, если роут не найден
$stateProvider # правида
# restricted
.state "restricted",
abstract: true
url: ""
views:
navBar:
templateUrl: 'shared/navbar.html'
"bgPageHeader":
templateUrl: 'shared/bg-pageheader.html'
"":
template: "<div ui-view></div>"
resolve:
deps: ['$ocLazyLoad', ($ocLazyLoad) ->
$ocLazyLoad.load [
"bootstrap"
],{ serie: true }
]
.state "restricted.landing",
url: "/"
controller: 'RoomController'
templateUrl: "shared/rooms.html"
resolve:
deps: ['$ocLazyLoad', ($ocLazyLoad) ->
$ocLazyLoad.load [
"js/angular/controllers/RoomController.js"
],{ serie: true }
]
return
]
app.
config [
'$ocLazyLoadProvider'
($ocLazyLoadProvider) ->
$ocLazyLoadProvider.config
debug: true
events: false
modules: [
{
name: 'bootstrap'
files: [
'bower_components/tether/dist/js/tether.min.js'
'js/bootstrap.min.js'
'css/bootstrap.min.css'
'css/style.css'
'bower_components/angular-material/angular-material.min.css' # angular material
'https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css' # font awesome
]
serie: true
}
]
]
Error: [ng:areq] http://errors.angularjs.org/1.5.0/ng/areq?p0=RoomController&p1=not%20aNaNunction%2C%20got%20undefined
at Error (native)
at http://localhost:63342/arenda/bower_components/angular/angular.min.js:6:416
at sb (http://localhost:63342/arenda/bower_components/angular/angular.min.js:23:63)
at Sa (http://localhost:63342/arenda/bower_components/angular/angular.min.js:23:150)
at http://localhost:63342/arenda/bower_components/angular/angular.min.js:86:318
at http://localhost:63342/arenda/bower_components/angular-ui-router/release/angular-ui-router.min.js:1:32868
at ka (http://localhost:63342/arenda/bower_components/angular/angular.min.js:79:16)
at u (http://localhost:63342/arenda/bower_components/angular/angular.min.js:66:326)
at g (http://localhost:63342/arenda/bower_components/angular/angular.min.js:58:136)
at http://localhost:63342/arenda/bower_components/angular/angular.min.js:57:279
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question