Comments (12)
I'm also having issues with the upgrade. A rudimentary Auth.signup and Auth.login, which worked with 0.0.12, no longer works on 0.0.14. The signup and login methods we static in 0.0.12 but now seem to be instance methods.
Was:
static login(moduleId, options: LoginOptions = {}, data): Promise<User> {
Now:
login(moduleId: AuthModuleId, data?: Object, options: LoginOptions = {'remember': true}): Promise<IUser> {
I did a clean install ionic start ionicv2-platform-auth sidemenu --v2 --ts
Added cloud-angular npm install --save @ionic/cloud-angular
Initialized the app ionic io init
And wired it up...
The TS error is...
Property signup does not exists on 'type of Auth'
import { Component, ViewChild } from '@angular/core';
import { App, ionicBootstrap, Platform, Nav } from 'ionic-angular';
import { Auth, User, CloudSettings, provideCloud } from '@ionic/cloud-angular';
import { StatusBar } from 'ionic-native';
import { Page1 } from './pages/page1/page1';
import { Page2 } from './pages/page2/page2';
const cloudSettings: CloudSettings = {
'core': {
'app_id': "1f589081"
}
};
@Component({
templateUrl: 'build/app.html'
})
class MyApp {
@ViewChild(Nav) nav: Nav;
rootPage: any = Page1;
pages: Array<{ title: string, component: any }>
constructor(private platform: Platform) {
this.initializeApp();
// used for an example of ngFor and navigation
this.pages = [
{ title: 'Page uno', component: Page1 },
{ title: 'Page dos', component: Page2 }
];
}
ngOnInit() {
console.log('app ngOnInit');
var details = {
'email': '[email protected]',
'password': 'secretpassword'
};
/**** The following approach worked in 0.0.12 *****/
Auth.signup(details).then(() => {
console.log("`user` is now registered");
}, (err) => {
console.log("something went wrong!")
});
}
initializeApp() {
this.platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
});
}
openPage(page) {
// Reset the content nav to have just this page
// we wouldn't want the back button to show in this scenario
this.nav.setRoot(page.component);
}
}
ionicBootstrap(MyApp, [provideCloud(cloudSettings)]);
from ionic-cloud-angular.
Try 0.0.14. I just forgot to bump the version of ionic-cloud
.
from ionic-cloud-angular.
Thanks @dwieeb , but now I'm getting this -
Looks like the es5 dist folder is missing the auth module
I have no Idea how the Typesciprt stuff gets bundled in the node_modeuls so I can'y really debug what's going on....
from ionic-cloud-angular.
What version is specified in your package.json
for @ionic/cloud-angular
? I was getting the exact same errors until I changed it to *
and reinstalled.
from ionic-cloud-angular.
It was 0.0.14, tried *, still doesn't work.
Can you explain something:
I see Auth is exported twice, once here,
https://github.com/driftyco/ionic-cloud-angular/blob/master/src/index.ts#L1 (export * from '@ionic/cloud';
)
And once here - https://github.com/driftyco/ionic-cloud-angular/blob/master/src/index.ts#L5
The second time it is used to add an @Injectable .
Does typesciprt always use the second one?
Why is the @Injectable here is never inject it myself?
from ionic-cloud-angular.
I Ask this because - 540400b is pretty recent which makes me suspect it's the colporate.
from ionic-cloud-angular.
@dwieeb I think this needs re opening...
from ionic-cloud-angular.
@cklanac The Auth service no longer has those static methods. 0.0.14 was a big change. Try this:
import {Component} from '@angular/core';
import {Auth, User} from '@ionic/cloud-angular';
@Component( ... )
export class MyApp {
constructor(public auth: Auth, public user: User) {
...
}
ngOnInit() {
console.log('app ngOnInit');
var details = {
'email': '[email protected]',
'password': 'secretpassword'
};
this.auth.signup(details).then(() => {
// success
}, (err) => {
console.log("something went wrong!")
});
}
}
The login method data and options parameters were swapped, because options should come after required parameters.
Try something like:
this.auth.login('basic', {'email': '[email protected]', 'password': 'secretpassword'});
from ionic-cloud-angular.
@sagivf The typescript errors are correct. It's saying you can't call login
/logout
/etc on Auth
class because they're no longer static methods. 0.0.14 had some changes from 0.0.12. See above. They're quick changes. Just inject the service into your constructor(s) and instead of Auth
use this.auth
.
Similarly, always use the this.user
variable to reference the current user.
This library and the ionic-cloud
client aren't full releases. We're still very much in beta and we're still trying to develop the best API for the client, which is why we've opened discussions such as #1, ionic-team/legacy-ionic-cloud#3, and ionic-team/legacy-ionic-cloud#13.
from ionic-cloud-angular.
I think I tried it and it failed but I will try again soon.
On Sun, 3 Jul 2016 at 9:31 PM Daniel Imhoff [email protected]
wrote:
@sagivf https://github.com/sagivf The typescript errors are correct.
0.0.14 had some changes from 0.0.12. See above. They're quick changes. Just
inject the service into your constructor(s) and instead of Auth use
this.auth.—
You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub
#6 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABxXuicXJAP233X7LBfZwRlcGeXafwFFks5qSAAHgaJpZM4JDnaT
.
from ionic-cloud-angular.
Hey @dwieeb, so you are correct changing it to instances work nicely 👍
There are a couple of related issues/comments:
ionic-team/legacy-ionic-cloud#10 (comment)
#7
from ionic-cloud-angular.
Nice, glad to hear! 👍
from ionic-cloud-angular.
Related Issues (20)
- Using with Ionic-Super-Starter HOT 6
- platform.toLowerCase is not a function HOT 5
- Deploy.load fails silently HOT 1
- Version 0.10.0 - Object prototype may only be an Object or null: undefined HOT 5
- access_token for linkedIn in undefined all the time
- rollup failed: Unexpected token HOT 2
- Build failure in iOS using ionic Packge HOT 42
- Doesnt work with Angular 4.0.0-rc.2 aot build HOT 10
- Able to use WKWebView 3.0? HOT 1
- Clearing notifications opens up Ionic app HOT 1
- I think ionic 2 is a nightmare, don't use it HOT 4
- Push imports complete RxJS library HOT 1
- CocoaPods was not found - [phonegap-plugin-push] HOT 1
- How to use this in browser ?
- not compatible with ionic3
- Ionic Deploy Error
- unable to install plugin in new ionic 3 project HOT 3
- cant build PROD HOT 2
- iOS app is crashing due to NSInvalidArgumentException in deploy plugin HOT 1
- OpaqueToken deprecated in Angular 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ionic-cloud-angular.