I know there is no direct integration of FlowJs with angular2 so i am trying to implement it by following ways but didn't get any success:
By Declare direct:
Included flow.js script file in index.html and following is the code of component.ts file:
import { Component, OnInit } from '@angular/core';
declare var Flow: any;
@Component({
selector: 'dashboard-page',
templateUrl: 'dashboard.component.html'
})
export class DashboardComponent implements OnInit {
public message: string;
constructor() {
this.message = 'Dashboard';
}
ngOnInit() {
var flow = new Flow({
target: '/api/photo/redeem-upload-token',
query: { upload_token: 'my_token' }
});
}
}
In this its giving me error: ' Flow is not defined'
By using @typings:
I have installed the @typings by @types/flowjs and then installed flow.js by using "npm install --save-dev @flowjs/flow.js" and then i have written following code in my component:
import { Component, OnInit } from '@angular/core';
import * as Flow from "@types/flowjs";
//or
//import * as Flow from "flowjs"; @Component({ selector: 'dashboard-page', templateUrl: 'dashboard.component.html' })
export class DashboardComponent implements OnInit {
public message: string;
constructor() {
this.message = 'Dashboard';
}
ngOnInit() {
var flow = new Flow({
target: '/api/photo/redeem-upload-token',
query: { upload_token: 'my_token' }
});
}
}
But in this its giving an error: "/node_modules/@types/flowjs/index.d.ts' is not a module".
How can i implement FlowJs with angular2?