angular.module('todo', ['ionic', 'ngCordova', 'ngMaterial', 'services'])
这是我如何包含服务模块。 这是我的services.js文件
angular.module('services', [])
.service('UserService', function() {
// For the purpose of this example I will store user data on ionic local storage but you should save it on a database
var setUser = function(user_data) {
window.localStorage.starter_facebook_user = JSON.stringify(user_data);
};
var getUser = function(){
return JSON.parse(window.localStorage.starter_facebook_user || '{}');
};
return {
getUser: getUser,
setUser: setUser
};
});
但我得到错误的模块错误或忘记加载。