从yeoman ui-router应用程序生成,我有一个状态-
$stateProvider
.state('exampleLink', {
url : '/exampleLink?photo=https://s3-us-west-2.amazonaws.com/trafficnow/439dcc60-303b-457e-940a-6308d9f0ee5f/9d12687c-7d09-4f63-afd3-b4abd0d03aaf.jpg',
templateUrl : 'views/someTemplate.html',
controller : 'SomeCtrl'
});
和一个控制器
angular.module('App')
.controller('SomeCtrl', function ($scope, $stateParams) {
$scope.obj = {
photo : $stateParams.photo,
};
});
在将配置中的$locationProvider.html5Mode(true);和索引文件中的<base href="/">添加到active HTML5 mood之后,它给出了以下错误。Cannot GET /sharedLink?photo=https://s3-us-west-2.amazonaws.com/trafficnow/439dcc60-303b-457e-940a-6308d9f0ee5f/9d12687c-7d09-4f63-afd3-b4abd0d03aaf.jpg
发布于 2016-04-05 03:13:11
看起来您在url属性的末尾缺少一个右引号。尝试将第一个代码片段替换为以下代码:
$stateProvider
.state('exampleLink', {
url : '/exampleLink?photo=https://s3-us-west-2.amazonaws.com/trafficnow/439dcc60-303b-457e-940a-6308d9f0ee5f/9d12687c-7d09-4f63-afd3-b4abd0d03aaf.jpg',
templateUrl : 'views/someTemplate.html',
controller : 'SomeCtrl'
});https://stackoverflow.com/questions/36410865
复制相似问题