我已经摆弄了我的项目试图重构它(我的所有控制器和配置都在一个文件中并且项目很大)使用模块用于控制器,当然在某些时候我做错了。问题是,现在我不能摆脱这个错误,即使我下载角度并尝试不同的版本。我摆脱它的唯一方法是,如果我根本不包括角度。为什么?!?!?!?!
编辑:现在这一切看起来都井井有条,但问题仍然存在。为什么?或者有角度会以某种方式忽略实际的顺序而且它会随机占用所有内容吗?填写代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Perfect Memorials Reports">
<meta name="author" content="Perfect Memorials">
<title>Perfect Memorials Reports</title>
{{ HTML::style('/resources/styles/preloader.css') }}
{{ HTML::style('/resources/styles/bootstrap.css') }}
{{ HTML::script('/resources/javascript/jquery.min.js') }}
<!-- JQuery UI -->
{{ HTML::style('/resources/plugins/jqueryui/css/no-theme/jquery-ui-1.10.3.custom.min.css') }}
{{ HTML::script('/resources/plugins/jqueryui/js/jquery-ui-1.10.3.custom.min.js') }}
{{ HTML::script('/resources/javascript/bootstrap.min.js') }}
<!-- Noty plugin -->
{{ HTML::script('/resources/plugins/noty/jquery.noty.js') }}
{{ HTML::script('/resources/plugins/noty/layouts/top.js') }}
{{ HTML::script('/resources/plugins/noty/themes/default.js') }}
<!-- JQuery UI touch enanle -->
{{ HTML::script('/resources/javascript/jquery.ui.touch-punch.min.js') }}
<!-- Datepicker -->
{{ HTML::script('/resources/javascript/datepicker/js/bootstrap-datepicker.js') }}
<!-- Chosen Plugin -->
{{ HTML::script('/resources/javascript/chosen.jquery.js') }}
<!-- Angular -->
{{ HTML::script('/resources/javascript/angular/angular.min.js') }}
{{ HTML::script('/resources/javascript/angular/angular-route.min.js') }}
{{ HTML::script('/src/Foundation/Application.js') }}
@yield('head')
{{ HTML::style('/resources/fonts/font-awesome-4.3.0/css/font-awesome.min.css') }}
{{ HTML::style('/resources/styles/chosen.css') }}
{{ HTML::style('/resources/styles/style.css') }}
<!-- Custom styles for this template -->
<link rel="shortcut icon" href="{{ URL::to('/') }}/favicon.ico?v=2" type="image/x-icon">
<base href="/">
</head>
<body ng-app="ReporterApplication" ng-controller="BootstrapController as bootstrap">
</body>
</html>
Application.js文件的代码:
/**
* Angular application main module
*
* @author Jorj Daniel <jorj_daniel@yahoo.com>
*/
var Application = angular.module('ReporterApplication',
['ngRoute', 'ui.select', 'ngSanitize']);
Application.config(['$routeProvider', '$interpolateProvider',
function($routeProvider, $interpolateProvider) {
$interpolateProvider.startSymbol('<%');
$interpolateProvider.endSymbol('%>');
$routeProvider
.when('/packing/scan.html', {
templateUrl: 'packing/scan.html',
controller: 'PackingScanController'
})
.when('/packing/stats.html', {
templateUrl: 'packing/stats.html',
controller: 'PackingStatisticsController'
})
.when('/packing/error.html', {
templateUrl: 'packing/error.html',
controller: 'PackingErrorController'
})
.when('/packing/shipping-statistics.html', {
templateUrl: 'packing/shipping-statistics.html',
controller: 'ShippingStatisticsController'
})
.when('/tracking/orders.html', {
templateUrl: 'tracking/orders.html',
controller: 'OrdersTrackerController'
})
.when('/tracking/orders-statistics.html', {
templateUrl: 'tracking/orders-statistics.html',
controller: 'TrackingStatisticsController'
})
.when('/jewelry-room.html', {
templateUrl: 'jewelry-room.html',
controller: 'JewelryRoomController'
})
.when('/administration/jobs', {
templateUrl: 'administration/jobs',
controller: 'AdministrationJobsController'
});
}]);
编辑2:包括一切。所有角度js代码当前都在引导程序文件中
编辑3:尝试从头开始重写,错误仍然存在
答案 0 :(得分:0)
因此,要将我的评论转换为答案,请从html标记中删除ng-app =“ReporterApp”,然后将其放入正文标记中。
看起来像这样:
<html>
<head>
<!-- all script includes here -->
</head>
<body ng-app="ReporterApplication">
</body>
</html>
这种方式不是在你包含它之前尝试使用库,而是在包含它之后使用库。如果您应用了模块的结构并按照我在上一个问题中的回答注入了依赖项,那么一切都应该可以正常工作。
<强>更新强>
啊,我看到了问题。您正在模块定义中使用interpolateprovider,而您应该将它放在.config()中。在定义模块时,您只注入依赖项。你不能这样注入interpolateProvider。
我猜应该是这样的:
var Application = angular.module('ReporterApplication',
['ngRoute', 'ui.select', 'ngSanitize']);
Application.config(['$routeProvider', '$interpolateProvider',
function($routeProvider, $interpolateProvider) {
$interpolateProvider.startSymbol('<%');
$interpolateProvider.endSymbol('%>');
$routeProvider
.when('/packing/scan.html', {
templateUrl: 'packing/scan.html',
controller: 'PackingScanController'
})
.when('/packing/stats.html', {
templateUrl: 'packing/stats.html',
controller: 'PackingStatisticsController'
})
.when('/packing/error.html', {
templateUrl: 'packing/error.html',
controller: 'PackingErrorController'
})
.when('/packing/shipping-statistics.html', {
templateUrl: 'packing/shipping-statistics.html',
controller: 'ShippingStatisticsController'
})
.when('/tracking/orders.html', {
templateUrl: 'tracking/orders.html',
controller: 'OrdersTrackerController'
})
.when('/tracking/orders-statistics.html', {
templateUrl: 'tracking/orders-statistics.html',
controller: 'TrackingStatisticsController'
})
.when('/jewelry-room.html', {
templateUrl: 'jewelry-room.html',
controller: 'JewelryRoomController'
})
.when('/administration/jobs', {
templateUrl: 'administration/jobs',
controller: 'AdministrationJobsController'
});
}]);