Angularjs 使用ui获取json链接的输出
我试图显示一个json结果。我使用ngRoute获得了这些代码Angularjs 使用ui获取json链接的输出,angularjs,angular-ui-router,Angularjs,Angular Ui Router,我试图显示一个json结果。我使用ngRoute获得了这些代码 .controller('ChannelViewCtrl', function ($scope, $rootScope, $routeParams, $http) { $scope.channel = {}; $http.get('http://example.com/channel/' + $routeParams.id).success(function(result){
.controller('ChannelViewCtrl', function ($scope, $rootScope, $routeParams, $http) {
$scope.channel = {};
$http.get('http://example.com/channel/' + $routeParams.id).success(function(result){
$scope.channel = result[0];
});
我现在尝试用几乎相同的代码使用ui路由,我只编辑$routeParams.id
到$stateParams.id
routerApp.controller('ChannelViewCtrl', function ($scope,$stateParams,$http) {
$http.get('http://example.com/channel/' + $stateParams.id).success(function(result){
$scope.channel = result[0];
})
});
但是我得到了这个错误:
没有指定输入文件
有人知道如何解决这个问题吗?您是否正在尝试访问
.php
文件?@Goldenowner。谢谢你伸出援手。如果你问的是这个链接,它来自drupal视图生成的json。看起来我只是去ngRoute路径