Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all 48979 articles
Browse latest View live

Update GoogleMarker icon?

$
0
0

@mrg250 wrote:

Hello, Im making an app where there are pins placed across a map (by google).
the thing I want to achieve is, that whenever a field in my database (firebase) changed , the markers’ icon changes aswell

the current process is:

}
    
    ionViewDidLoad(){
      
    
        this.loadMap()
        this.getNewReports()
        this.deleteMark()
        
  
    
    }
  
    updateReports(){
      database().ref('reports/').on('child_changed', snap=>{
        if(!snap.exists || !this.markers){
            return
        }
        var report = snap.val()
        this.markers[report['number']+'_'+report['timestamp']]['icon'] =  'assets/imgs/pins/pin_'+report['type']+'_'+report['stage']+'.png';

      })
    }

    getNewReports(){

      var reportCount = 0;
      var that = this
      database().ref('reports/').on('child_added', (snapshot)=> {
        var report = snapshot.val()

        let lat = report['lat']
        let long = report['long']
      
        var id = report['number']+'_'+report['timestamp']
        var p = 'assets/imgs/pins/pin_'+report['type']+'_'+report['stage']+'.png';
        var icon = new google.maps.MarkerImage(p, null, null, null, new google.maps.Size(29, 38))
        var marker = new google.maps.Marker({
          id: id,
          position: {lat: +lat, lng: +long},
          icon:icon,
          map: this.map
        })
        this.markers[id] = marker
        marker.setMap(this.map)
        google.maps.event.addListener(marker, "click", function () {
          const modal = that.modalCtrl.create('MarkerInfoPage', {
            type: report['type'],
            author: report['author'],
            desc: report['desc'],
            image: report['path'],
            number: report['number'],
            time: report['timestamp'],
            isHazard: report['isHazard'],
            
          });
          modal.present();
          
          
        });

      })
    }
    

this basically creates an info page for each new marker. My goal is, whenever I change a field in my database (happens inside the modal), the icon of the marker will change as well.

for example, current icon is :

  1. pin_trash_0,
  2. pressing a button which will change a field in the database
  3. pin_trash_1

Right now, what I have, is that it’s not updating the icon rightaway (after exiting the modal), but when I enter ionViewDidLoad (which happens after I reenter the app)

How do I achieve this?

Posts: 2

Participants: 1

Read full topic


How check if checkbox is checked? And how sum a value?

$
0
0

@AmandaCAlves wrote:

In a code like this, for example, how can I check if the checkboxes were checked and show an alert with the values’ sum? There will be more checkbox than those two.

< ion-list>

< ion-item>
< ion-label>Pepperoni< /ion-label>
< ion-checkbox [(ngModel)]=“pepperoni” value=“3.5”

< ion-item>
< ion-label>Sausage< /ion-label>
< ion-checkbox [(ngModel)]=“sausage” value=“4.2”< /ion-checkbox>
< /ion-item>

< ion-row center>
< ion-col text-center>
< ion-button click=“getValue()”>Value< ion-button>
< /ion-col>
< /ion-row>
< /ion-list>

Posts: 1

Participants: 1

Read full topic

Enabling Production Mode without ionic build--prod ( CI )

$
0
0

@shepard wrote:

I am building an Ionic App in a Continuous Integration environment (CircleCI).

In my workflow steps I have:
npm run build --prod

However, this is not enabling production mode.
Using import { environment } from '../../../environments/environment';
environment.production = false;

Using import { isDevMode } from '@angular/core';
isDevMode = true;

This works fine: ionic build --prod
Production Mode is enabled ( as per environment.production )

If I attempt to use:
npm run ionic:build --prod
Then I get the error:
missing script: ionic:build

So, is there a way to enable production mode without using ionic build --prod ?
Or will I need to install ionic/app-scripts in CircleCI build?

Posts: 2

Participants: 1

Read full topic

Not found config.xml in bluid browser

$
0
0

@ndblackandblue wrote:

Hi, everyone, I’m try to build my app to browser, but from some reason after build i get this error:

cordova.js:865 [Browser][cordova.js][xhrStatusChangeHandler] Could not XHR config.xml: Not Found
VM47 SplashScreenProxy.js:163 [Browser][cordova.js][xhrStatusChangeHandler] Could not XHR config.xml: Not Found

and my app still freeze with a white screen!

Posts: 1

Participants: 1

Read full topic

Any ionic v4 tag components?

Confusion in documentation

I want to play rtmp live streaming in an ionic 3 application, I tried using cordova plugin for rtmp still not working

$
0
0

@Akarsh12 wrote:

import { Component } from ‘@angular/core’;

import { IonicPage, NavController, NavParams } from ‘ionic-angular’;

import { StreamingMedia, StreamingVideoOptions } from ‘@ionic-native/streaming-media’;

@IonicPage()

@Component({

selector: ‘page-tv’,

templateUrl: ‘tv.html’,

})

export class TvPage {

constructor() {

// let options: StreamingVideoOptions = {

// successCallback: () => { console.log(‘Video played’) },

// errorCallback: (e) => { console.log(‘Error streaming’) },

// orientation: ‘landscape’,

// shouldAutoClose: true,

// controls: false

// };

// this.streamingMedia.playVideo(‘rtmp://103.130.188.26:1935/ntv/live/live1’, options);

}

start(){

alert(“start video”);

(<any>window).videoStreamer.streamRTMP(‘rtmp://103.130.188.26:1935/ntv/live/live1’,alert(‘success’), alert(‘failed’)).onConnectionSuccess((data)=>alert(data)).onError((data)=>alert(data));

}

Posts: 1

Participants: 1

Read full topic

Ionic 4 PWA hide toolbar buttons when ion-menu-button is visible

$
0
0

@IonicGeoff wrote:

I’m trying to create a typical web page menu, in the toolbar, using three buttons, and I want them to be hidden when the ion-menu-button becomes visible. i.e. when the screen size is too small to show them.

Is there an ion- construct that does this, or do I have to do it with css, or some other way?

Posts: 1

Participants: 1

Read full topic


Salesforce integration

$
0
0

@babita112 wrote:

Hi guys,
Hope you are doing well.
I have a query regarding salesforce integeration in ionic. How can we call salesforce apis in ionic mobile app?

Posts: 1

Participants: 1

Read full topic

Ionic serve stops after transpile started

$
0
0

@mrc_prasad wrote:

I am using ionic 3 to develop the application. I am able to generate the apk without any problem. But if I run ionic serve after transpile started nothing is happening. I am using macbook pro. Below is the system info:

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

global packages:

Cordova CLI : 8.1.2 (cordova-lib@8.1.1) 

local packages:

@ionic/app-scripts : 3.1.0
Cordova Platforms  : none
Ionic Framework    : ionic-angular 3.9.2

System:

Node  : v10.14.2
npm   : 6.4.1 
OS    : macOS High Sierra
Xcode : Xcode 9.3.1 Build version 9E501![54%20AM|690x429](upload://iGixq68Umjb04cm1BI0LR1EwnrS.png) ![54%20AM|690x429](upload://iGixq68Umjb04cm1BI0LR1EwnrS.png) 

Can anyone share a possible solution. I am having problem with this project only. If I create a sample project its working fine.

Posts: 1

Participants: 1

Read full topic

I have integrated rtmp streaming media in an ionic application but video is not playing

$
0
0

@Akarsh12 wrote:

I m building an ionic application where I am trying to integrated live streaming into my app using rtmp stream. It will open the player but the Video is not playing.
Here is my code:

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-media',
templateUrl: 'media.html',
})
export class MediaPage {

  constructor() { 
   }

 start(){
 alert("start video");

  (<any>window).videoStreamer.streamRTMP
 ('rtmp://103.130.188.26:1935/ntv/live/live1',alert('success'), 

 alert('failed')).onConnectionSuccess((data)=>alert(data))
 .onError((data)=>alert(data));

  }
 }

Posts: 1

Participants: 1

Read full topic

Rxjs/internal/types.d.ts error

$
0
0

@woonmar wrote:

I was trying to build chat app and successfully did it. But when i ran ionic cordova build android i got the following error.

[app-scripts] [14:46:38]  ionic-app-scripts 3.2.1
[app-scripts] [14:46:38]  watch started ...
[app-scripts] [14:46:38]  build dev started ...
[app-scripts] [14:46:38]  clean started ...
[app-scripts] [14:46:38]  clean finished in 9 ms
[app-scripts] [14:46:38]  copy started ...
[app-scripts] [14:46:39]  deeplinks started ...
[app-scripts] [14:46:39]  deeplinks finished in 53 ms
[app-scripts] [14:46:39]  transpile started ...
[app-scripts] [14:46:44]  typescript: E:/Ionic/retail/node_modules/rxjs/internal/types.d.ts, line: 81
[app-scripts]             ';' expected.
[app-scripts]       L81:  export declare type ObservedValueOf<O> = O extends ObservableInput<infer T> ? T : never;
[app-scripts] [14:46:44]  typescript: E:/Ionic/retail/node_modules/rxjs/internal/types.d.ts, line: 81
[app-scripts] [14:46:44]  typescript: E:/Ionic/retail/node_modules/rxjs/internal/types.d.ts, line: 81
[app-scripts]             ';' expected.
[app-scripts]       L81:  export declare type ObservedValueOf<O> = O extends ObservableInput<infer T> ? T : never;
[app-scripts]             Expression expected.
[app-scripts]       L81:  export declare type ObservedValueOf<O> = O extends ObservableInput<infer T> ? T : never;
[app-scripts]             'ObservableInput' only refers to a type, but is being used as a value here.
[app-scripts] [14:46:44]  typescript: E:/Ionic/retail/node_modules/rxjs/internal/types.d.ts, line: 81
[app-scripts] [14:46:44]  typescript: E:/Ionic/retail/node_modules/rxjs/internal/types.d.ts, line: 81
[app-scripts] [14:46:44]  typescript: E:/Ionic/retail/node_modules/rxjs/internal/types.d.ts, line: 81
[app-scripts]       L81:  export declare type ObservedValueOf<O> = O extends ObservableInput<infer T> ? T : never;
[app-scripts]             Cannot find name 'infer'.
[app-scripts]       L81:  export declare type ObservedValueOf<O> = O extends ObservableInput<infer T> ? T : never;
[app-scripts]             Cannot find name 'T'.
[app-scripts]       L81:  export declare type ObservedValueOf<O> = O extends ObservableInput<infer T> ? T : never;
[app-scripts]             Cannot find name 'T'.
[app-scripts]       L81:  export declare type ObservedValueOf<O> = O extends ObservableInput<infer T> ? T : never;
[app-scripts]             'never' only refers to a type, but is being used as a value here.
[app-scripts]       L81:  export declare type ObservedValueOf<O> = O extends ObservableInput<infer T> ? T : never;
[app-scripts] [14:46:44]  typescript: E:/Ionic/retail/node_modules/rxjs/internal/types.d.ts, line: 81
[app-scripts] [14:46:44]  typescript: E:/Ionic/retail/node_modules/rxjs/internal/types.d.ts, line: 81

Posts: 2

Participants: 1

Read full topic

Dependency of two firebase "tables"

$
0
0

@Broccoli38 wrote:

Hello everybody,

in list.ts i am trying to connect to two tables of my database with angular fire:

itemListRef$: Observable;
profileListRef$: Observable;
item = {} as Item;
profile = {} as Profile;

constructor(public navCtrl: NavController, private database: AngularFireDatabase,
public alertCtrl: AlertController,) {

this.itemListRef$ = this.database.list(`/item`).valueChanges();
this.itemListRef$.subscribe(task => this.item = item);  
this.profileListRef$ = this.database.list(`/profile/${this.item.userID}`).valueChanges();
this.profileListRef$.subscribe(profile => this.service = profile); 

}

In table “item” is the information about profile key saved. With this key I want get the information like username or review from “profile”.
How can I get the data from the “profile” table with the user information from the table “item”?

Is something like this possible?

{{profile.(item.userID).username}}

Posts: 1

Participants: 1

Read full topic

Ionic v4: Change active tab dynamically

$
0
0

@mavillavishnu wrote:

Hello everyone. Require your help. I am using Ionic V4 to develop an app. It has a tabs page with four tabs in it. I have a button in Tab1 and on click it should change the tab to second tab.
Sorry if i was not clear but please help me.

Posts: 4

Participants: 2

Read full topic

Iframe reloads again if focused out in Ionic 3

$
0
0

@setu1421 wrote:

I am working on an Ionic 3 application. Inside a div, i am loading an external url in an iframe and it is loading perfectly. But it creates problem when focuses out. The iframe reloads every time when it focuses out.

Scenario-01: In the page where i have loaded the iframe, there are other controls outside of the iframe such as a text box to enter some data. So, when i click on the textbox, the keyboard appears but at the same time iframe reloads again.

Scenario-02: I have one menu sliding drawer from left in the application. When i open the sliding drawer to select another page, i could see the iframe of the existing page reloads again.

Scenario-03: The external url that i have loaded in the iframe has some input controls. So, i want to enter something in those input boxes, the keyboard appears but at the same time iframe gets reloaded and i could not provide any data in those input boxes.

From my assumption, iframe is causing problems when it focuses out. So, i tried to capture the blur event of that iframe and try to stop the propagation of the event.

<iframe width="100%" height="100%" [src]="url| safeHtml:'resourceUrl'" (ionBlur)="checkBlur($event)" (ionFocus)="checkFocus($event)"></iframe> 

But, both ionFocus and ionBlur events were not triggering.

For now, when i tried with Android application, all the scenarios trigger iframe reload. As keyboard does not appears in browser, when i tried with Browser, only Scenario-02 triggers iframe reload.

Iframe should load at the first time only. Then user can do whatever operations inside the iframe or outside the iframe but the iframe should not load again.

How to stop reloading the iframe if it focuses out by keyboard or sliding drawer or anything?

Posts: 1

Participants: 1

Read full topic


Using async await on function with http post in it

$
0
0

@Vartex05 wrote:

Hi, i have a function, which checks, if the url from input is correct url of api, that my app is communicating with. Code looks like this :

 checkCorrectUrl(url){
   return new Promise(resolve => {
     let headers = new Headers();
     headers.append('Content-Type', 'text/xml;charset=utf-8');
     headers.append('SOAPAction', '.....');
     var body = '.......';
     this.http.post(url+"/atws.asmx", body, {headers: headers}).timeout(3000).subscribe(data => {
         resolve(true);
       },(err)=>{
       resolve(false);
     });
   });
 }

I want to refactor it using async await, to make it cleaner, but somehow, it doesnt work. i tried it like this

  async checkCorrectUrl(url){
      let headers = new Headers();
      headers.append('Content-Type', 'text/xml;charset=utf-8');
      headers.append('SOAPAction', '....');
      var body = '.....';
      await this.http.post(url+"/atws.asmx", body, {headers: headers}).timeout(3000).toPromise().then(data => {
        return true;
        },(err)=>{
        return false;
      });
  }

but it doesnt wait for the http post and resolves … Any ideas what am i doing wrong?

Posts: 1

Participants: 1

Read full topic

Ionic is loading wrong pages without giving any routes

$
0
0

@Gazoh wrote:

So i made a couple pages ‘Settings’, ‘Vragen’, ‘getting-started’, ‘create-account’ so i’ve set my router in

app.component.ts

to my ‘Getting-started’ page and the first thing ionic does is load SettingsPage and than the ‘Getting-started’ page. and whenever i delete that whole page because i though maybe i did something wrong and this time it loaded ‘Vragen’ Page and so. What am i doing wrong?

this is my tabs router:

import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {TabsPage} from './tabs.page';
import {SettingsPage} from '../settings/settings.page';

const routes: Routes = [
    {
        path: 'tabs',
        component: TabsPage,
        children: [
            {
                path: 'tab1',
                children: [
                    {
                        path: '',
                        loadChildren: '../tab1/tab1.module#Tab1PageModule'
                    }
                ]
            },
            {
                path: 'tab2',
                children: [
                    {
                        path: '',
                        loadChildren: '../tab2/tab2.module#Tab2PageModule'
                    }
                ]
            },
            {
                path: 'tab3',
                children: [
                    {
                        path: '',
                        loadChildren: '../tab3/tab3.module#Tab3PageModule'
                    }
                ]
            },
            {
                path: 'settings',
                children: [
                    {
                        path: '',
                        loadChildren: '../settings/settings.module#SettingsPageModule'
                    }
                ]
            },
        ]
    },
    {
        path: '',
        redirectTo: '/tabs/tab1',
        pathMatch: 'full'
    }
];

@NgModule({
    imports: [
        RouterModule.forChild(routes)
    ],
    exports: [RouterModule]
})
export class TabsPageRoutingModule {
}

my router links in tab1 page

<ion-header>
    <ion-toolbar>
        <ion-title>
            <span class="alignTitelLeft">Timeline</span>
            <ion-badge class="hoeveelVragen" color="transparent" routerLink="/vragen" routerDirection="forward">1</ion-badge>
            <div class="titleIcons" routerLink="/vragen" routerDirection="forward">
                <i class="fas fa-comment-alt"></i>
            </div>
        </ion-title>
    </ion-toolbar>
</ion-header>

my app.module.ts

import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {RouteReuseStrategy} from '@angular/router';

import {IonicModule, IonicRouteStrategy} from '@ionic/angular';
import {SplashScreen} from '@ionic-native/splash-screen/ngx';
import {StatusBar} from '@ionic-native/status-bar/ngx';
import { Geolocation } from '@ionic-native/geolocation/ngx';
import { LocationAccuracy } from '@ionic-native/location-accuracy/ngx';

import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {SettingsPageModule} from './settings/settings.module';
import {VragenPageModule} from './vragen/vragen.module';
import { HttpClientModule } from '@angular/common/http';


@NgModule({
    declarations: [AppComponent],
    entryComponents: [],
    imports: [
        BrowserModule,
        HttpClientModule,
        IonicModule.forRoot({
            mode: 'md'
        }),
        SettingsPageModule,
        VragenPageModule,
        AppRoutingModule,
    ],
    providers: [
        StatusBar,
        SplashScreen,
        Geolocation,
        LocationAccuracy,
        {provide: RouteReuseStrategy, useClass: IonicRouteStrategy}
    ],
    bootstrap: [AppComponent]

})
export class AppModule {
}

i’ve removed the app.component.ts routerlink to ‘Getting-started’ page because i want to fix this first

Posts: 1

Participants: 1

Read full topic

Ionic display 3rd-party-licenses

$
0
0

@Dovel wrote:

How to display all 3rd-party-licenses used in Ionic by NPM and Native Plugins, etc?
In native Angular it generates a file 3rdpartylicenses.txt to the dist folder. But not in Ionic.
Ionic should generate such file to comply with the law of copyright licenses.

Posts: 1

Participants: 1

Read full topic

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'listeners' of undefined

$
0
0

@DarylNine wrote:

Hello everyone. I’m having the following error in the browser after building my ionic 3 app.

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'listeners' of undefined
TypeError: Cannot read property 'listeners' of undefined
    at module.exports.<anonymous> (main.js:520)
    at module.exports.emit (events.js:146)
    at module.exports.ClientRequest._connect (request.js:268)
    at request.js:159
    at t.invoke (polyfills.js:3)
    at Object.onInvoke (core.js:4626)
    at t.invoke (polyfills.js:3)
    at r.run (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (core.js:4617)
    at t.invokeTask (polyfills.js:3)
    at r.runTask (polyfills.js:3)
    at o (polyfills.js:3)
    at c (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (core.js:4617)
    at t.invokeTask (polyfills.js:3)
    at r.runTask (polyfills.js:3)
    at o (polyfills.js:3)
defaultErrorLogger @ core.js:1350

Ionic Info

Ionic:

ionic (Ionic CLI) : 4.10.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.2

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.3, (and 7 other plugins)

System:

NodeJS : v10.15.1 (/usr/local/bin/node)
npm : 6.7.0
OS : macOS High Sierra

PS: The project was initially built on Windows 10 (Working fine) before switching to Mac Os High Sierra.

Posts: 1

Participants: 1

Read full topic

How to use storage-data in Promise? (IONIC4)

$
0
0

@xs2bas wrote:

I’m trying to build a dynamic url using values stored with Storage.

The code on the page I need the data looks like this:

this.remotedataservice.getSectionData('invoice')
        .subscribe(data => {
          this.build(data);
        }, err => {
          console.log(err);
        });

Than the code in the service looks like this:

getSectionData(section): Observable<any> {
    this.storage.get('login').then((login) => {
      this.username = login.username;
    });

    let response = this.http.get('https://www.someurl.com/' + section + '/' +  this.username;
    return response;
  }

When I hard-code the variable (this.username) things work just fine, but using the storage-value doesn’t work.
I know there’t time needed to retrieve the data, but I don’t know how to return the function-return-value within the promise.
Lot’s of things I tried (like returning a new Promise etc.) for hours and hours, but can’t get it to work, so hope someone can help.

Posts: 1

Participants: 1

Read full topic

Viewing all 48979 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>