【发布时间】:2015-10-27 06:22:26
【问题描述】:
试图转换这个
.service('dataStore', function($localStorage,$scope){
this.entfeeds=[];
this.topfeeds=[];
this.intfeeds=[];
})
.controller('GenFeedCtrl', function ($scope,....
$scope.feeds = FeedList.get(feedSources, dataStore.topfeeds);
有效,除了在手机cordova上运行时,它只返回两个项目
所以我尝试使用 ngStorage 来存储数组
.service('dataStore', function($localStorage,$scope){
$scope.$storage = $localStorage.$default({
etf:[],
tpf:[],
itf:[]
});
this.entfeeds=$storage.etf;
this.topfeeds=$storage.tpf;
this.intfeeds=$storage.itf;})
.controller('GenFeedCtrl', function ($scope,....
$scope.feeds = FeedList.get(feedSources, dataStore.topfeeds);
但不能在浏览器emu上运行,会出现以下错误
Error: [$injector:unpr] Unknown provider: $scopeProvider <- $scope <- dataStore
http://errors.angularjs.org/1.3.13/$injector/unpr?p0=copeProvider%20%3C-%20%24scope%20%3C-%dataStore 在http://localhost:8100/lib/ionic/js/ionic.bundle.js:8762:12
【问题讨论】:
标签: angularjs cordova ionic ng-storage