Skip to content

Can't use within app config #429

@iKonstX

Description

@iKonstX

Hey,

I'm having the problem that ocLazyLoad doesn't work within the app config (where all my routing stuff is located). It does work in controllers but I need it in the config to make js files load on demand.

routing.js
app.config(['$routeProvider', "$locationProvider",'$translateProvider', '$ocLazyLoadProvider', function($routeProvider, $locationProvider, $translateProvider, $ocLazyLoadProvider)

index.html
<script type="text/javascript" src="assets/js/ocLazyLoad.js?v=1"></script>

application.js
var app = angular.module("arazpvp", [ 'ngRoute', 'ngStorage', 'angular-encryption', 'ui.tinymce', 'smoothScroll', 'ngCookies', 'pascalprecht.translate', 'oc.lazyLoad']);

When adding:
routing.js
$ocLazyLoad.load({files: ['forum/community-forum.controller.js']});

I get the following error:

Failed to instantiate module arazpvp due to:
ReferenceError: $ocLazyLoad is not defined
    at https://araz4story.com/pvp/app/bin/routing.js?v=187:5:2
    at Object.invoke (https://araz4story.com/pvp/assets/js/angular.js?v=4:155:70)
    at d (https://araz4story.com/pvp/assets/js/angular.js?v=4:148:171)
    at https://araz4story.com/pvp/assets/js/angular.js?v=4:149:125
    at p (https://araz4story.com/pvp/assets/js/angular.js?v=4:8:184)
    at g (https://araz4story.com/pvp/assets/js/angular.js?v=4:148:72)
    at eb (https://araz4story.com/pvp/assets/js/angular.js?v=4:156:654)
    at c (https://araz4story.com/pvp/assets/js/angular.js?v=4:79:175)
    at Pc (https://araz4story.com/pvp/assets/js/angular.js?v=4:79:488)
    at ue (https://araz4story.com/pvp/assets/js/angular.js?v=4:77:283

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions