Quantcast
Channel: Ionic Forum - Latest topics
Viewing all 70434 articles
Browse latest View live

Error: Cannot match any routes. URL Segment: 'set/4DEjDIwExmgjJGPdvtto'

$
0
0

@lily28 wrote:

I’m facing a routing issue. I want to navigate to set page however there are error saying it cant be match, I dont really know what is wrong with the code. The error is as below

Error: Cannot match any routes. URL Segment: ‘set/4DEjDIwExmgjJGPdvtto’

Here is my app-routing.module.ts

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

const routes: Routes = [
  { path: 'login', loadChildren: './login/login.module#LoginPageModule' },
  { path: 'register', loadChildren: './register/register.module#RegisterPageModule' },
  { path: '', redirectTo: 'login', pathMatch: 'full' },
  { path: '', loadChildren: './pages/tabs/tabs.module#TabsPageModule' },
  { path: 'set', loadChildren: './pages/set/set.module#SetPageModule' },
  { path: 'set/id', loadChildren: './pages/set/set.module#SetPageModule' }
];

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

This is my tab2.html

<ion-header>
    <ion-toolbar color="primary">
      <ion-title>Alert lists</ion-title>
    </ion-toolbar>
  </ion-header>

  <ion-content>
    <ion-fab vertical="bottom" horizontal="end" slot="fixed">
      <ion-fab-button routerLink="/set">
        <ion-icon name="add"></ion-icon>
      </ion-fab-button>
    </ion-fab>

    <ion-list>
      <ion-item button [routerLink]="['/set', set.id]" *ngFor="let set of (sets | async)">
        {{ set.notes }}
      </ion-item>
    </ion-list>
  </ion-content>

Can anyone help me with this, thank you

Posts: 2

Participants: 1

Read full topic


Ionic 4 pass parm

$
0
0

@scoppato72 wrote:

Hi everyone, I have a problem with passing data from one page to another. The page that displays the data is called contents.page.html

<ion-header>
  <ion-toolbar>
    <ion-title>APPapagna 2.0</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>
     <ion-item *ngFor="let item of items">
        <ion-row>
          <ion-col col-3>
              {{item.Titolo}}
            </ion-col>
          <ion-col col-3>
            {{item.Nome_Punto}}
          </ion-col>
          <ion-col col-3>
              <button
              ion-button
              color="primary"
              item-right
              (click)="viewEntry(item)">view</button>
          </ion-col>
        </ion-row>

    </ion-item>
  

</ion-content>

this is the file code instead contenuti.page.ts

import { Component } from '@angular/core';
import { NavController, NavParams } from '@ionic/angular';
import { HttpClient } from '@angular/common/http';
import { Router } from '@angular/router';

@Component({
  selector: 'app-contenuti',
  templateUrl: './contenuti.page.html',
  styleUrls: ['./contenuti.page.scss'],
})
export class ContenutiPage {

   public items : Array<any> = [];

   constructor(
    public navCtrl: NavController,
    public http   : HttpClient, 
    public passa_var : Router
    )
     { }


   ionViewWillEnter() : void {
      this.load();
   }

   load() : void {
      this.http
      .get('http://www.my-dominio.com/retrieve-data.php')
      .subscribe((data : any) =>
      {
         console.dir(data);
         this.items = data;
      },
      (error : any) =>
      {
         console.dir(error);
      });
   }
  
  
   viewEntry(item) : void {
      ??????
   }


}

clicking on “view” I have to go to the detail page.
I can’t understand how to pass data to the detail page to view the data of the single record. Can anyone give me directions on how to pass data?

Posts: 1

Participants: 1

Read full topic

Ionic 4 File Plugin

$
0
0

@Bhekor wrote:

Hello,
Please can someone point me to a video (even written) tutorial on how to use Ionic Native File Plugin to create a file. Hopefully into an Excel File with multiple sheets. Thanks in advance.

Posts: 1

Participants: 1

Read full topic

Floating label color

$
0
0

@jschneiderPatinfo wrote:

Hi everybody,

I’m looking for a solution to change the color of the label and the underline when floating in an input field.

Now it’s in primary color but I want to change it to black… I’ve tried some solution found on this forum but nothing works for me.

Thanks for your help.

Posts: 1

Participants: 1

Read full topic

Ionic 4 ion-textarea autoGrow does not display properly with ngModel?

$
0
0

@sirdas wrote:

Hello, when the ion-textarea is first displayed with text using ngModel, the autoGrow directive does not work as the height of the textarea (within ion-textarea) is initially set to 0px. As soon as I edit the text, the height is set automatically and works. Here’s my code:

<ion-textarea [(ngModel)]="note" placeholder="Write a note here..." autoGrow="true" autoFocus="true" maxlength="400"></ion-textarea>

Is there a way to get autogrow working with ngmodel when it first displays? Thanks

Posts: 1

Participants: 1

Read full topic

Inserting Seperators in Bound Ion-list

$
0
0

@JohnCressman wrote:

I’m trying to insert separators/dividers at certain spots in my list. I have the list bound to an observable:

  <ion-list>
    <ion-item button *ngFor="let item of (results | async)" routerDirection="forward" routerLink="/{{ item.itemPage }}">
      <ion-label text-wrap>
        <h3>{{ item.name }}</h3>
      </ion-label>
    </ion-item>
  </ion-list>

But, I want to know if it’s possible to insert a divider based on the value of one of the elements. for instance, I have item.type = “P” if it’s a protocol and “S” if it’s a separator.

Is this possible? If so, how can it be done, since you’re already in the ITEM loop at that point.

Thank you.

Posts: 1

Participants: 1

Read full topic

App builds but emulator refuses to run (iOS 12.3.1)

$
0
0

@tonyross wrote:

Hi,

I’ve been stumped with this one since last week. I recently completely rebuilt my iMac owing to it having too many versions of frameworks and things like nodejs, etc. At any rate, I have a clean iMac.

Having reinstalled node, Xcode, and all of the ionic components, etc. I now find that I cannot get my apps to run in the emulators.

I run:

ionic cordova emulate ios --list

and that gives me (amongst other emulators) the following iPad devices:

iPad-Air--3rd-generation-, 12.2
iPad-Air, 12.2
iPad-Air-2, 12.2
iPad--5th-generation-, 12.2
iPad-Pro--9-7-inch-, 12.2
iPad-Pro, 12.2
iPad-Pro--12-9-inch---2nd-generation-, 12.2
iPad-Pro--10-5-inch-, 12.2
iPad--6th-generation-, 12.2 <-- I use this one
iPad-Pro--11-inch-, 12.2
iPad-Pro--12-9-inch---3rd-generation-, 12.2

As I’ve identified in that list, I use the iPad 6th generation emulator. I then run:

ionic cordova emulate ios --target="iPad--6th-generation-, 12.2"

After all of the masses of console output, finally, in the results, I get:

** BUILD SUCCEEDED **

Deploying to simulator
Running command: /Users/tonyross/development-work/...path-to-files.../myappsname/node_modules/ios-sim/bin/ios-sim launch /Users/tonyross/development-work/...path-to-files.../myappsname/platforms/ios/build/emulator/myappsname.app --devicetypeid com.apple.CoreSimulator.SimDeviceType.iPad--6th-generation-, 12.2 --log /Users/tonyross/development-work/...path-to-files.../myappsname/platforms/ios/cordova/console.log --exit
[ios-sim] Simulator already running.
[ios-sim] An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
[ios-sim] An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=1):
The request to open "com.bundleidhere.myapp" failed.
The request was denied by service delegate (SBMainWorkspace) for reason: NotFound ("Application "com.bundleidhere.myapp" is unknown to FrontBoard").
Underlying error (domain=FBSOpenApplicationErrorDomain, code=4):
[ios-sim] The operation couldn’t be completed. Application "com.bundleidhere.myapp" is unknown to FrontBoard.
	Application "com.bundleidhere.myapp" is unknown to FrontBoard.
[ios-sim] com.bundleidhere.myapp: -1
[ios-sim] logPath: /Users/tonyross/development-work/...path-to-files.../myappsname/platforms/ios/cordova/console.log
Simulator successfully started via `ios-sim`.

As can be seen, the build succeeds, and the simulator starts but the app does not run.

It mentions “FrontBoard”…what is FrontBoard? When I search on this and these issues, I get links to support for both React Native and Flutter, neither of which are in use in this app.

Can anyone help? This seems to have just started recently. The ionic info for this is below:

Ionic:

   ionic (Ionic CLI)  : 4.12.0
   Ionic Framework    : ionic-angular 3.9.6
   @ionic/app-scripts : 3.2.4

Cordova:

   cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms     : ios 5.0.1
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.4.1, (and 13 other plugins)

System:

   ios-deploy : 1.9.4
   ios-sim    : 8.0.1
   NodeJS     : v10.16.0 (/usr/local/bin/node)
   npm        : 6.9.0
   OS         : macOS Mojave
   Xcode      : Xcode 10.2.1 Build version 10E1001

Thanks in advance for your time. I’ve been searching for a solution to this since last week.

Tony

Posts: 1

Participants: 1

Read full topic

Ionicframework.com/framework shows old version


Ion Select Save Data

$
0
0

@OmarElAl wrote:

Hey guy I want to make an ion-slect in my app. But, i want to save a variable using some data of a json document that I have. So i have everything done, but my question is. When de user select the value how did I use that value to use another information in the json to save it on a variable… thanks!

Posts: 1

Participants: 1

Read full topic

Background video in IOS plays in-player or not at all

$
0
0

@SirajKakeh wrote:

I’m trying to have a video background on a page

I’m using video tag with source and with some styling it’s working fine on web and Android, but on IOS it’s not showing unless I add autoplay attribute which is openning video player on IOS devices instead of showing the video in the background :sweat_smile:
code sample:

<video playsinline webkit-playsinline autoplay loop muted  id="bg-video">
     <source src="assets/backvideo.mp4" type="video/mp4">
</video>

I tried adding <preference name="AllowInlineMediaPlayback" value="true" /> to confing.xml but that didn’t solve the issue
Does anyone have this issue? How can I overcome it?

Posts: 1

Participants: 1

Read full topic

Dynamically Update Text Based On Date

$
0
0

@Shmoji wrote:

I have read a lot about how to get the current date and use DateTime, but I cannot figure something out.

I am trying to update a variable in a typescript file based on the day. Right when the next day hits, I want this variable to be updated.

How do I do this? I figured out a way to update it whenever I navigate to another page, but this requires if statements in every page’s typescript file’s ngInit() checking if the current date is equal to the date the last time I loaded a page.

I would appreciate any ideas.

Posts: 2

Participants: 2

Read full topic

Cordova Windows 10 shows Blank screen

$
0
0

@robertnic wrote:

I’m trying to make windows version of my app it creates debug version successfully but all I get is blank screen.

config.xml

<preference name="windows-target-version" value="10.0" />
<preference name="windows-phone-target-version" value="10.0" />

Commands tried

ionic cordova build windows

ionic cordova run windows --arch="x86"

same results.

Any ideas?

Posts: 1

Participants: 1

Read full topic

Error: Missing includeSubdomains attribute [NetworkSecurityConfig] localhost

$
0
0

@hophat wrote:

I am developing an ionic 3 project that uses the background mode plugin, when the build release is in error

platforms android app src main res xml network_security_config.xml: 4: Error: Missing includeSubdomains attribute [NetworkSecurityConfig]
         <domain> localhost </domain>

I have found a solution but have not solved the problem yet. Hope everyone will help me

Posts: 1

Participants: 1

Read full topic

Ionic 4 ion-segment scrollable actived position

$
0
0

@nagarajsabhahith wrote:

When we have more number of segments in ion-segments with scrollable true, when we change selected segment through programmatically the selected segment is not visible in display (Manually we need to scroll segments)… How to set position of selected segment or how to make it center of selected segment.

example: Added swipeleft and swiperight gesture to the segments, based on the swipe direction i am changing selected segment programmatically. Segments is changing but its not scrolled to selected

Please help me out

Posts: 1

Participants: 1

Read full topic

Make status bar to change according to device defalut status bar

$
0
0

@premktr wrote:

for my app, I need to make a status bar to change according to the device default status bar

Posts: 1

Participants: 1

Read full topic


Ionic V3 app looses focus after Keyboard appearance

$
0
0

@SilvaDev4 wrote:

Hi

I have an Ionic app using ionic v3, In the login page when i input wrong username and password the application div or input looses focus. its like the keyboard hide and leaves the keyboard space.I tried following the link setting-focus-to-an-input-in-ionic but didnt work. see code my below:

 class LoginPage {
    isEnabled: boolean = false;
    public usercreds: Credentials = {
        username: '',
        password: '',
    };

    @ViewChild('username') inputUsername: any;
    @ViewChild('password') inputPassword: any;

    constructor(
        public navCtrl: NavController,
        public firebaseAnalytics: FirebaseAnalytics,
        public alertCtrl: AlertController,
        public loadingCtrl: LoadingController,
        private auth: AuthService,
        private navParams: NavParams,
        platform: Platform,
    ) {
        this.firebaseAnalytics
            .logEvent('page_view', { page: 'Login' })
            .then((res: any) => console.log(res))
            .catch((error: any) => console.error(error));

        if (this.navParams.get('Logout')) {
            this.auth
                .Logout()
                .then(() => {
                    this.navCtrl.setRoot(LandingPage);
                })
                .catch();
        } else {
            this.auth
                .isLoggedIn()
                .then(isLoggedIn => {
                    if (isLoggedIn) {
                        this.navCtrl.setRoot(HomePage);
                    }
                })
                .catch();
        }
        const page: this = this;
        platform.registerBackButtonAction(() => {
            page.goToLanding();
        });
    }

    ionViewLoaded(): void {
        setTimeout(() => {
            this.inputUsername.setFocus();
            this.inputPassword.setFocus();
        }, 150);
    }

    public async login(user: Credentials): Promise<void> {
        this.response = '';
        this.inputUsername.setFocus();
        this.inputPassword.setFocus();
        const loadingCtrl: Loading = this.loadingCtrl.create({
            content: 'logging in, please wait...',
        });
        try {
            this.isEnabled = true;
            loadingCtrl.present();
            await this.auth.Login(user.username, user.password);
            loadingCtrl.dismiss();
            this.isEnabled = false;
            this.navCtrl.setRoot(ImpactPage);
        } catch (e) {
            let message: string = 'Login attempt failed, please try again later.';

            if (e && e.error_description) {
                message = e.error_description;
            }
            this.alertCtrl
                .create({
                    title: 'Login Failed',
                    message: message,
                    buttons: [
                        {
                            text: 'Dismiss',
                            handler: () => {
                                window.scrollTo(0, 0);
                                window.document.body.scrollTop = 0;
                            },
                        },
                    ],
                    enableBackdropDismiss: true,
                })
                .present();
            this.isEnabled = false;
            loadingCtrl.dismiss();
        }
    }
}

I also added <preference name="KeyboardDisplayRequiresUserAction" value="false" /> in the config.xml file still doesn’t work. Please assist. Thank you.

Posts: 1

Participants: 1

Read full topic

How can I save a downloaded file with Capacitor in Ionic4 Angular?

$
0
0

@filippo-ots wrote:

Hi everyone!

I have recently published my Ionic 4 Angular App both as web app and as native Android app.
In the native Android app, everything works fine, except saving a downloaded file.

To download and save a file, I’ve always used file-saver npm package as follows (this is a shared service that I invoke every time I have to download something, from a PDF to an image, etc…):

import { saveAs } from 'file-saver';

// ...

saveGenericFile(api: string, fileinfos: any, idFile: string): any {
    let mediaType = 'application/pdf';
    let fileName = '';

    if (fileinfos != null) {
      mediaType = fileinfos.contentType;
      fileName = fileinfos.fileName;
    }

    const headers = this.base.commonHeader;
    const url = this.baseUrl + api + '?id=' + idFile;
    this.http.post(url, null, { headers, responseType: 'blob' }).subscribe(
      (response) => {
        // tslint:disable-next-line: prefer-const
        let blob = new Blob([response], { type: mediaType });
        saveAs(blob, fileName);
      }, e => {
        console.error(e);
        this.toastsvc.generateToast('ERROR! An error occurred while saving this File, try later or contact support', 'danger');
      }, () => {
        /* do nothing */
      }
    );
  }

As I said above, this code snippet works fine, but just when I have to save something from the web release.

The only online examples I was able to find were all about Cordova and/or previous/deprecated versions.
About Capacitor, I just found this documentation and from that I just found this code snippet:

import { Plugins, FilesystemDirectory, FilesystemEncoding } from '@capacitor/core';

const { Filesystem } = Plugins;

fileWrite() {
  try {
    Filesystem.writeFile({
      path: 'secrets/text.txt',
      data: "This is a test",
      directory: FilesystemDirectory.Documents,
      encoding: FilesystemEncoding.UTF8
    });
  } catch(e) {
    console.error('Unable to write file', e);
  }
}

But the issue is that my function above returns a blob and this one only accept a string for data.

So, is there any Capacitor-Native equivalent feature that I can use to download (and save) Blob files both when running as web-app and when running as Android native app?

Thanks in advance!


UPDATE

I’ve also tried the following, but it’s not working:

import { Platform } from '@ionic/angular';
//...

useCordovaDl: boolean = false;
  constructor(
    private http: HttpClient,
    private base: BaseService,
    private requestsService: RequestsService,
    private toastsvc: ToastService,
    private platform: Platform
  ) {
    this.baseUrl = base.baseUrl;
    if (this.platform.is('ios') || this.platform.is('android')) {
      this.useCordovaDl = true;
    }
  }

//...

saveGenericFile(api: string, fileinfos: any, gidFile: string): any {
    let mediaType = 'application/pdf';
    let fileName = '';

    if (fileinfos != null) {
      mediaType = fileinfos.contentType;
      fileName = fileinfos.fileName;
    }

    const headers = this.base.commonHeader;
    const url = this.baseUrl + api + '?id=' + gidFile;
    this.http.post(url, null, { headers, responseType: 'blob' }).subscribe(
      (response) => {
        if (!this.useCordovaDl) {
          // tslint:disable-next-line: prefer-const
          let blob = new Blob([response], { type: mediaType });
          saveAs(blob, fileName);
        } else {
          this.blobFileWrite(fileName, response);
        }
      }, e => {
        console.error(e);
        this.toastsvc.generateToast('ERROR! An error occurred while saving this File, try later or contact support', 'danger');
      }, () => {
        /* do nothing */
      }
    );
  }

  blobFileWrite(filename: string, blobfile: Blob) {
    const reader = new FileReader();

    // This fires after the blob has been read/loaded.
    reader.addEventListener('loadend', (e: any) => {
      const text = e.srcElement.result;
      this.fileWrite(filename, text);
    });

    // Start reading the blob as text.
    reader.readAsText(blobfile);
  }

  fileWrite(filename: string, filedata: string) {
    try {
      Filesystem.writeFile({
        path: filename,
        data: filedata
        // ,
        // directory: FilesystemDirectory.Documents,
        // encoding: FilesystemEncoding.UTF8
      });
    } catch (e) {
      console.error('Unable to write file', e);
    }
  }

Posts: 1

Participants: 1

Read full topic

Need to call functionality based on FCM Notification, without user interacting with Notification bar

$
0
0

@MadhuWork wrote:

Hi Guys,

My requirement

In my ionic App i have a function which should be triggered when i receive Notification from server.

Tricky part comes now, when i receive notification weather App is in background/closed it should trigger the function in App. Without user tapping the notification bar.

How can i achieve this. Do we have other way/plugins which may help my requirement.

Kindly suggest

Thank you.

Posts: 1

Participants: 1

Read full topic

The request contains malformed or mismatching credentials [ App ID does not match requested project. ]

$
0
0

@ShankarGuru wrote:

I have tried to perform phone authentication using firebase,After putting the latest google-services.json file, the app was unable to generate OTP, It was throwing this error:

ERROR Error: Uncaught (in promise): The request contains malformed or mismatching credentials [ App ID does not match requested project. ]

So i removed:

  1. node_modules
  2. android platform
  3. google-services-json file

Then created a new project in firebase and downloaded latest google-services.json file.

After the download(google-services.json), installed node modules, Then added google-services.json file in root folder of the project, Then builded for android. Now if again i am trying to generate the OTP still throwing the same error. Any help?

Posts: 1

Participants: 1

Read full topic

Failed to fetch api on android device (browser ok)

$
0
0

@SDA wrote:

Hi,

When I run my ionic 4 app in the browser , fetch works and retrieves the GET result from my express nodejs server.
On my android device, it seems the api is not even called and I get TypeError: Failed to fetch.
I enabled cors on my express server
My server is running http (not https), is that why?
Thank you for your help,
Bruce
PS: firebase doesn’t work either

Posts: 1

Participants: 1

Read full topic

Viewing all 70434 articles
Browse latest View live


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