我有一段代码(.ts文件),负责使用$routeprovider和angular.module加载与html相关的内容。相应的文件在本地计算机中正确加载,但在其服务器中会导致如下所述的错误。
注意:我们将angularjs与typescript和javascript结合使用,还使用闭包。最终,js&closure的用法将被删除。
.ts文件:
import 'angular-route';
import * as angular from 'angular';
import {AbcLinkController} from './filepath';
/**@ngInject */
function configureRoutes($routeProvider: angular.route.IRouteProvider) {
$routeProvider.when('abcLink/:pathVariable1:pathVariable2', {
templateUrl:'abclink/abc-file-name.ng',
controller: AbcLinkController,
controllerAs: 'ctrl'
});
}
export const module: angular.IModule =
angular.module('abc', ['ngMaterial', 'ngRoute'])
.config(configureRoutes);
app.js文件中的sinppet:
module =
angular
.module(
'applicationName.app',
[
'ngMockE2E',
'ngRoute',
'ngSanitize',
'angularMoment',
abc.module.name,
...
浏览器控制台错误:
Error: [$injector:unpr] http://errors.angularjs.org/1.6.4-local+sha.617b36117/$injector/unpr?p0=%24%24routeParams%24%24Provider%20%3C-%20%24%24routeParams%24%24
at js.js?437e15ca-1865-4083-a6cd-f574d2d2b01d:4107
at js.js?437e15ca-1865-4083-a6cd-f574d2d2b01d:4142
at Object.y [as get] (js.js?437e15ca-1865-4083-a6cd-f574d2d2b01d:4139)
at js.js?437e15ca-1865-4083-a6cd-f574d2d2b01d:4142
at y (js.js?437e15ca-1865-4083-a6cd-f574d2d2b01d:4139)
at v (js.js?437e15ca-1865-4083-a6cd-f574d2d2b01d:4140)
at Object.instantiate (js.js?437e15ca-1865-4083-a6cd-f574d2d2b01d:4140)
at js.js?437e15ca-1865-4083-a6cd-f574d2d2b01d:4192
at Object.link (js.js?437e15ca-1865-4083-a6cd-f574d2d2b01d:4509)
at js.js?437e15ca-1865-4083-a6cd-f574d2d2b01d:4117 "<div ng-view=\"\" class=\"ng-scope\" data-ng-animate=\"1\">"
这里可能出了什么问题?
暂无答案!
目前还没有任何答案,快来回答吧!