Questions tagged [ionic2-providers]

16 questions
16
votes
6 answers

Cannot determine the module for class X in X.ts! Add X to the NgModule to fix it error in ionic2

I am facing an issue when I try to build my app using the following command : ionic cordova run android --prod --release Everything runs fine if I run the command as below: ionic cordova run android The error Iam getting is : Error: Cannot…
user1188867
  • 3,726
  • 5
  • 43
  • 69
2
votes
2 answers

What are all the possibilities to pass the data one component to another component without navigation or route in angular 2 type script?

I am a beginner for learning Angular 2 type script. I want to pass the data between one component to another component? Serives.ts import {Component, Injectable} from '@angular/core'; // Name Service export interface myData { …
Peri
  • 158
  • 1
  • 4
  • 16
2
votes
2 answers

Ionic2 filetransfer - No provider for Transfer

I'm trying to use filetransfer as a provider in my app, but I'm getting this problem. "No provider for Transfer!" I can't find the solution. This is my code. My provider import { Injectable } from '@angular/core'; import { Transfer,…
Mystearica
  • 167
  • 1
  • 3
  • 12
1
vote
1 answer

Getting "Cannot read property prompt of undefined" from one provider to another

alert-service.ts public Alert = { prompt: () => { return new Promise((resolve, reject) => { let prompt = this.alertCtrl.create({ title: 'Enter username', inputs: [ { …
1
vote
1 answer

Error Login facebook Angular 2

I'm trying to implement the Facebook log in my application with the following example: ng2-facebook-sdk When redirecting to the page of facebook shows me: Can not load the URL: The domain of this URL is not included in the domains of the…
1
vote
1 answer

media-plugin-with-compression - TypeError: window.Media is not a constructor

This plugin: media-with-compression worked well a few days ago, but now I'm getting this when I try to record: EXCEPTION: Uncaught (in promise): TypeError: window.Media is not a constructor I already have declared: declare var window: any; declare…
Mystearica
  • 167
  • 1
  • 3
  • 12
0
votes
1 answer

How to use database method ( Sqlite plugin) as a Provider in Ionic 3?

I am using SqLite native plugin in Ionic 3 App. As per documentation , it works as expected. In app.commponent.ts , I created the table like this: this.sqlite.create({ name: 'sdt.db', location: 'default' }) .then((db)…
mnhmilu
  • 2,327
  • 1
  • 30
  • 50
0
votes
1 answer

ionic2: API response data undefined?

I'm using ionic2, I want to make login request to api server, but I have response => undefined this is the code in provider: loginUser(email, password, macId, token) { let userObject = { "email": email, "password": password, …
Al-shimaa Adel
  • 767
  • 1
  • 10
  • 26
0
votes
1 answer

Ionic 2 - Can not access value assigned by a http Provider by other functions in angular 2

Here is my code I'm trying to assign data in variable 'user' by setUserDetails function which calls a http provider function fetchUserDetails which returns data as expected. The getUserDetails prints null value. @Injectable() export class…
Aman Singh
  • 39
  • 5
0
votes
0 answers

navigate back to tabspage and give an active tab with

I am working on an application and I want to navigate back to the TabsPage and than the specific second tab of 4 tabs. So what I tried based on other answers on stack is this: export class ModalPage { public tab: Tabs; …
Sireini
  • 4,142
  • 12
  • 52
  • 91
0
votes
2 answers

Why does my API call return a 401 from an Ionic app but not Postman?

I followed the guidance at Smart of the Home to produce the following code in a provider for an Ionic 2 App. return new Promise(resolve => { // We're using Angular HTTP provider to request the data, // then on the response, it'll map the JSON…
anthonyhumphreys
  • 1,051
  • 2
  • 12
  • 25
0
votes
1 answer

View not updating on variable change in Ionic 2 and Angular 2

I'm new to using Angular 2 so I may just not be understanding what's wrong. However, I have an *ngIf that is supposed to show a button if a variable is false and not show the button if the variable is true. However once I've updated the variable to…
0
votes
1 answer

Ionic2, Http request don´t work correctly in starting page

I created a simple app (sidemenu template) and a provider (conexao-home.ts). In a new page called teste i created a function buscarUsuarios (associated a one button), and it calls the function getRemoteUsers in provider. In ionViewDidLoad i put the…
Murilo
  • 173
  • 1
  • 5
  • 15
0
votes
1 answer

ionic2 provider "cannot load module"

I'm trying to add a provider to my application,but getting this error Uncaught Error: Cannot find module "../providers/login/loginservice" Project structure Here is how the app.module.ts looks import { BrowserModule } from…
Shruti Nair
  • 1,982
  • 8
  • 30
  • 57
0
votes
1 answer

alert from a provider in ionic2

My idea is to create an alert in a provider and use it in which ever page its needed.so I wrote this code in provider constructor(public alertCtl:AlertController) { } presentDismissAlert( navCtrl: NavController) { let alert =…
Lisa
  • 655
  • 3
  • 10
  • 34
1
2