【发布时间】:2014-11-24 12:51:19
【问题描述】:
我收到了这个错误
参数 'AppCtrl' 不是函数,得到字符串
我的 app.js 如下:
var App = angular.module('App', ['ionic']);
App.service("FreshlyPressed", ["$http","$log",FreshlyPressed]);
App.controller("AppCtrl", "FreshlyPressed", ["$scope", "$log", AppCtrl]);
function AppCtrl($scope, FreshlyPressed, $log){
$scope.refresh = function(){
FreshlyPressed.getBlogs();
}
}
function FreshlyPressed($http, $log){
this.getBlogs = function(){
$http.jsonp("https://public-api.wordpress.com/rest/v1/freshly-pressed?callback=JSON_CALLBACK")
.success(function(result){
$log.info(JSON.stringify(result.posts));
});
}
}
不知道我哪里出错了,我已经将 FreshlyPressed 作为参数放入 AppCtrl 函数中。
【问题讨论】:
标签: javascript angularjs