我希望在应用启动时启动后台服务,重启后服务会自动启动
document.addEventListener('deviceready', function() {
myService = cordova.plugins.myService;;
upload();
},
TRUE);
答案 0 :(得分:0)
您需要将此服务注入您的控制器
.controller('myCtl', myCtl);
function myCtl(LoginService) {
$scope.username = null;
$scope.password = null;
$scope.doLogin = LoginService.loginUser;
}
然后在你的视图中
<div ng-controller="myCtl">
...
<input type="text" ng-model="username">
<input type="password" ng-model="password">
<button type="button" ng-click="doLogin(username, password)">
Login
</button>
...
</div>