Can't connect to monaca backend
-
Hello,
I would like to register users by using backend monaca. I follow the instruction by configuring iOS https://docs.monaca.io/en/reference/config/ios_configuration/#access-origin
but it still doesn’t work. This is my code. Thank you in advancevar module = angular.module('my-app', ['onsen']); module.controller('RegisterController', function() { this.register = function() { monaca.cloud.User.register(this.username, this.password) .done(function() { console.log('Registration is success!'); }) .fail(function(err) { console.log(err.text); console.log('Registration failed!'); }); }; });
<ons-page ng-controller="RegisterController as page" id="register.html"> <ons-toolbar> <div class="center">Input</div> </ons-toolbar> <div style="text-align: center; margin-top: 30px;"> <p> <ons-input id="username" modifier="underbar" placeholder="Username" float ng-model="page.username"></ons-input> </p> <p> <ons-input id="password" modifier="underbar" type="password" placeholder="Password" float ng-model="page.password"></ons-input> </p> <p style="margin-top: 30px;"> <ons-button ng-click="page.register()">Register</ons-button> </p> </div> </ons-page>```
-
@iriekun Are you using the Monaca debugger or just the preview tool? Also, do you get an error? Based on your response, I will make an example from there if that doesn’t solve it.
-
@munsterlander yes i used both monaca debugger and preview tool. There is no error. It simply didn’t save the username and password to database after I click on register button. Please help! thank you in advance