I am trying to use $ocLazyLoad
inside of Angular.js with TypeScript. However I keep getting a Unknown provider error. I am including it in my primary app:
index.module.ts
/// <reference path="../../.tmp/typings/tsd.d.ts" />
/// <reference path="index.route.ts" />
/// <reference path="index.config.ts" />
/// <reference path="index.run.ts" />
module myApp {
'use strict';
angular.module('myApp', [
'ui.router',
'oc.lazyLoad'])
.config(RouterConfig)
.config(Config)
.run(RunBlock);
}
The error come from when I try to include it in my RouterConfig
:
index.route.ts
module myApp {
'use strict';
export class RouterConfig {
static $inject = ['$stateProvider', '$urlRouterProvider', '$ocLazyLoad'];
constructor($stateProvider: ng.ui.IStateProvider, $urlRouterProvider: ng.ui.IUrlRouterProvider, $ocLazyLoad: oc.ILazyLoad) {
$urlRouterProvider.otherwise('/dashboard');
$stateProvider
.state('dashboard', {
url: '/dashboard',
templateUrl: 'app/modules/core/dashboard/dashboard.html'
});
}
}
}
The really strange part is that I can include $ocLazyLoadProvider
without any problems. This is a very bare-bones setup from Yeoman using gulp, typescript, and ui-router.