You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now on app initialization I want to login using SF dev creds and Oauth.
I did a forcejs install using
npm install forcejs --save-dev
And in my app.ts file I am trying to import same. App.ts -
import {Component, ViewChild} from '@angular/core';
import {ionicBootstrap, Platform, MenuController, Nav} from 'ionic-angular';
import {StatusBar} from 'ionic-native';
import {HelloIonicPage} from './pages/hello-ionic/hello-ionic';
import {ListPage} from './pages/list/list';
//ERROR on this line - TypeScript error: app/app.ts(7,24): Error TS2307: Cannot find module 'forcejs'
// wbile doing a gulp build
import * as force from 'forcejs';
@Component({
templateUrl: 'build/app.html'
})
class MyApp {
@ViewChild(Nav) nav: Nav;
// make HelloIonicPage the root (or first) page
rootPage: any = HelloIonicPage;
pages: Array<{title: string, component: any}>;
constructor(
private platform: Platform,
private menu: MenuController
) {
this.initializeApp();
// set our app's pages
this.pages = [
{ title: 'Hello Ionic', component: HelloIonicPage },
{ title: 'My First List', component: ListPage }
];
}
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.
// Login in Salesforce using forcejs
force.init({
proxyURL: "https://dev-cors-proxy.herokuapp.com/"
});
force.login().then(() => {
console.log("logged in");
});
StatusBar.styleDefault();
});
}
openPage(page) {
// close the menu when clicking a link from the menu
this.menu.close();
// navigate to the new page if it is not the current page
this.nav.setRoot(page.component);
}
}
ionicBootstrap(MyApp);
Hello Kaushik, Just wondering if you had chance to fix this issue. I am facing a similar issue on my Ionic2 app. Would appreciate if you shed any lights on this.
I solved this issue by copying the force.js and pasting it in app folder, next to app.ts. I also renamed the force.js to force.ts. Then I could reference it in app.ts like this:
I am working as a noob on my ionic 2 / ang 2 application. I am trying to set it up to use forcejs auth implementation.
Now I create a basic app following the ionic 2 tutorial here - http://ionicframework.com/docs/v2/getting-started/tutorial/
Now I am trying to integrate my force js implementation based on - http://coenraets.org/blog/2015/10/integrating-ecmascript-6-web-applications-with-salesforce-using-oauth-and-rest/
Now on app initialization I want to login using SF dev creds and Oauth.
I did a forcejs install using
And in my app.ts file I am trying to import same. App.ts -
Now check top of the page for imports
I can see forcejs under node_modules folder but not sure now how to import same.
Please help with same.
The text was updated successfully, but these errors were encountered: