Angular js with Parse
Angular js with Parse
我正在学习angular js如何使用解析后端。这是我的代码:
angular.module('AuthApp', []).controller(['ctrl', function($scope) {
Parse.initialize("PfF63Z7XdWtctidrATGigEFQsHh6aui6V68BmWSU", "GIpF3DJGBfprXAml5GLMPhCuldAnyXDLNY41M7zV");
$scope.submit()=function(){
var Person = Parse.Object.extend("person");
var person = new Person();
person.set("name", $scope.name);
person.set("email", $scope.email);
person.save();
}
}]);
最好在app.js中初始化Parse,这样它只会被调用一次。我不确定是否有它在控制器中运行会是一个问题(这可能取决于你的控制器是如何使用的),但在任何情况下,你不希望它初始化每次控制器实例化。
在模块config
中执行config后,我在run方法中进行了Parse初始化这样Parse API就可以被任何需要的控制器使用。
,
angular.module('myApp', [
'ngAnimate',
'ngCookies',
'ngResource',
'ngRoute'
])
.config( ['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
//route provider stuff
}])
.run(function() {
Parse.initialize('mg4MQuTvHvSxppLwkSdxaidaosudaoudaoudaoudao', '59a89989asdklasdlkahdahdahasdhasdahdashkLLL');
});
相关文章:
- Fighting with FRP
- issue with FB.Event.subscribe
- JSON.parse没有'不能使用Javascript
- geolocation-marker.js conflict with markerclusterer.js
- Angular 2.0 with JavaScript or TypeScript?
- 为什么不推荐使用“with”?是否有更好或其他方法可以“下降”到对象的命名空间
- WebComponentsJS with IE10
- Meteor with Parse - 在 Android 设备上运行 - 未定义 Parse
- Json parse with in JavaScript
- Parse query innerQuery with relation
- parse HTMLElmentObject with innerHTML in javascript
- JSON.stringify / parse oddness with quote marks
- jQuery ajax - SyntaxError: JSON.parse with fine json
- Working with Parse.com dates
- Parse vcard with Javascript
- Titanium Appcelerator parse Youtube JSON with API
- Angular js with Parse
- Parse json with javascript
- parse google place json with javascript
- Parse getJson with variable