Quantcast
Channel: Ionic Forum - Latest posts
Viewing all 228554 articles
Browse latest View live

Ionic 4 conditional ion-button property

$
0
0

Sorry, yes that is correct. I removed it.

            <ion-button 
                        [fill]=“myVarTrue? 'clear':'solid'”
                        expand="block"
                        (click)="toggleMode('offline')">UTILITIES</ion-button>

I still have the issue described above.

Any thoughts on how to dynamically configure the button as either clear or solid based upon the variable?

Thanks again,

Brent


Ionic 4 conditional ion-button property

$
0
0

I know I could use *ngIf and have two ion-buttons. I was hoping to not have to that.

HTTP: Onesignal does not accept my message

$
0
0

My app (Ionic 4) receive notification through onesignal native plugin. I used onesignal online desk to test the app, and the onesignal API with postman to send notification via api. All ok.
Then I made a simple utility to send the notifications, using HTTP (cordova-plugin-advanced-http 2.0.9 "Advanced HTTP plugin").

I can send a notification with POSTMAN with body:

{“app_id”: “id_omitted”,
“contents”: {“en”: “English Message”},
“included_segments”: [“Subscribed Users”]}

w/o any problem about header and auth but every time I got from the onesignal API server (that run correcly with Postman) the errorcode 400 with description:

{“errors”:[“contents must be key/value collections by language code”]}

This is my code (run() is a function called by a click of a button, url and headers are defined as constant):

constructor(private http: HTTP) {
    this.body = {
      "app_id": "cut cut cut cut cut",
      "contents": { "en": "English Message" },
      "included_segments": ["Subscribed sers"]
    }
  }

  run() {

    console.log("*************************************")
    console.log("payload: ", this.body)
    console.log("*************************************")

    this.http.post(this.url, this.body, this.header).then(data => {
      console.log(data.status);
      console.log(data.data);
      console.log(data.headers);
    }).catch(error => {
      console.log(error.status);
      console.log(error.error);
      console.log(error.headers);
    })
 }

if I “stringify” body, the result is:

{“app_id”: “omittedByMe”, “contents”: {“en”: “English Message”},“included_segments”: [“Subscribed Users”]}

exactly the same of the postman body… why contents is not accepted?

Any help will be useful

P.

Using ionic 4 and ng2-pdf-viewer getting “ERROR Error: Uncaught (in promise): Error: Template parse errors”

$
0
0

I’ve imported ng2-pdf-viewer and set it up as per the example, but I get the “ERROR Error: Uncaught (in promise): Error: Template parse errors:” error.

I’ve tried moving the import to the home.ts, but that didn’t work either. I really need to figure this out.

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 { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';

import { PdfViewerModule } from 'ng2-pdf-viewer';

@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
  imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, PdfViewerModule],
  providers: [
    StatusBar,
    SplashScreen,
    PdfViewerModule,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

home.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
  providers: [ ]
})
export class HomePage {

  public pdf;
  constructor() {
    this.pdf = 'http://www.axmag.com/download/pdfurl-guide.pdf';
  }

}

home.html

<ion-header>
  <ion-toolbar>
    <ion-title>
      NG2-PDF-VIEWER
    </ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>
  <pdf-viewer src="{{pdf}}" original-size="true" show-all="true"></pdf-viewer>
</ion-content>

full error

ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'src' since it isn't a known property of 'pdf-viewer'.
1. If 'pdf-viewer' is an Angular component and it has 'src' input, then verify that it is part of this module.
2. If 'pdf-viewer' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("

<ion-content>
  <pdf-viewer [ERROR ->]src="{{pdf}}" original-size="true" show-all="true"></pdf-viewer>
</ion-content>
"): ng:///HomePageModule/HomePage.html@9:14
'pdf-viewer' is not a known element:
1. If 'pdf-viewer' is an Angular component, then verify that it is part of this module.
2. If 'pdf-viewer' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("

<ion-content>
  [ERROR ->]<pdf-viewer src="{{pdf}}" original-size="true" show-all="true"></pdf-viewer>
</ion-content>
"): ng:///HomePageModule/HomePage.html@9:2
Error: Template parse errors:
Can't bind to 'src' since it isn't a known property of 'pdf-viewer'.
1. If 'pdf-viewer' is an Angular component and it has 'src' input, then verify that it is part of this module.
2. If 'pdf-viewer' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("

<ion-content>
  <pdf-viewer [ERROR ->]src="{{pdf}}" original-size="true" show-all="true"></pdf-viewer>
</ion-content>
"): ng:///HomePageModule/HomePage.html@9:14
'pdf-viewer' is not a known element:
1. If 'pdf-viewer' is an Angular component, then verify that it is part of this module.
2. If 'pdf-viewer' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("

<ion-content>
  [ERROR ->]<pdf-viewer src="{{pdf}}" original-size="true" show-all="true"></pdf-viewer>
</ion-content>
"): ng:///HomePageModule/HomePage.html@9:2
    at syntaxError (compiler.js:2430)
    at TemplateParser.push../node_modules/@angular/compiler/fesm5/compiler.js.TemplateParser.parse (compiler.js:20605)
    at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._parseTemplate (compiler.js:26171)
    at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileTemplate (compiler.js:26158)
    at compiler.js:26101
    at Set.forEach (<anonymous>)
    at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileComponents (compiler.js:26101)
    at compiler.js:26011
    at Object.then (compiler.js:2421)
    at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents (compiler.js:26010)
    at resolvePromise (zone.js:831)
    at resolvePromise (zone.js:788)
    at zone.js:892
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:17290)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
    at drainMicroTaskQueue (zone.js:601)

There’s not that much to it, I’m not sure how I’m screwing it up.

Ionic 4 conditional ion-button property

$
0
0

I literally just went into Ionic 4.4 project and did this:

  <ion-button size="small" [fill]="true? 'outline':'solid'" (click)="publisherModeToggle()">
        <ion-label slot="start">{{ publisherMode? 'Publisher':'Creator'}}</ion-label>
        <ion-icon slot="end" [name]="publisherMode? 'paper-plane':'easel'"></ion-icon>
  </ion-button>

All works, when its “true” I see outline, when it false I see solid button

Question about Ionic 4 + firebase

$
0
0

It is working, I had a mistake in action which never fired to store the data in my actual code.

Ionic 4 conditional ion-button property

$
0
0

Thanks it turns out it was the type of quotes. I copied your first answer with quotes - “. First one works, second one gives me the error. Thanks again for your help.

   [fill]="true? 'clear':'solid'" 
   [fill]=“myVarTrue? 'clear':'solid'”

Using ionic 4 and ng2-pdf-viewer getting “ERROR Error: Uncaught (in promise): Error: Template parse errors”

$
0
0

Hey man, so the error you are getting means the element’s schema is unknown to Angular. Feels like you are using PDF viewer inside lazily loaded Home page. I suggest you add you PDFViewer import into Home pages module.ts file.

Basically make sure you import PDFViewerModule into every page that is lazy loaded (not part of app.module) - into their respective module file.


Geofence plugin not triggering Notification when device entered in geofence radius

$
0
0

This issue is for both platform ios and android.

Cordova : 7.1.0
npm: 6.4.1
node : v8.12.0

my package.json :
{
“name”: “MyRetailShop”,
“version”: “0.0.1”,
“author”: “Ionic Framework”,
“homepage”: “http://ionicframework.com/”,
“private”: true,
“scripts”: {
“start”: “ionic-app-scripts serve”,
“clean”: “ionic-app-scripts clean”,
“build”: “ionic-app-scripts build”,
“lint”: “ionic-app-scripts lint”
},
“dependencies”: {
@angular/animations”: “5.2.11”,
@angular/common”: “5.2.11”,
@angular/compiler”: “5.2.11”,
@angular/compiler-cli”: “^8.0.0”,
@angular/core”: “5.2.11”,
@angular/forms”: “5.2.11”,
@angular/http”: “5.2.11”,
@angular/platform-browser”: “5.2.11”,
@angular/platform-browser-dynamic”: “5.2.11”,
@ionic-native/core”: “~4.20.0”,
@ionic-native/geofence”: “^4.20.0”,
@ionic-native/open-native-settings”: “^4.20.0”,
@ionic-native/splash-screen”: “~4.20.0”,
@ionic-native/status-bar”: “~4.20.0”,
@ionic/pro”: “2.0.4”,
@ionic/storage”: “2.2.0”,
“cordova-android”: “^8.0.0”,
“cordova-ios”: “4.5.5”,
“cordova-open-native-settings”: “^1.5.2”,
“cordova-plugin-add-swift-support”: “1.7.2”,
“cordova-plugin-compat”: “^1.2.0”,
“cordova-plugin-device”: “^2.0.2”,
“cordova-plugin-geofence”: “git+https://github.com/cowbell/cordova-plugin-geofence.git”,
“cordova-plugin-ionic-keyboard”: “^2.1.3”,
“cordova-plugin-ionic-webview”: “^4.0.1”,
“cordova-plugin-splashscreen”: “^5.0.2”,
“cordova-plugin-statusbar”: “^2.4.2”,
“cordova-plugin-whitelist”: “^1.3.3”,
“es6-promise-plugin”: “^4.2.2”,
“ionic-angular”: “3.9.5”,
“ionicons”: “3.0.0”,
“rxjs”: “5.5.11”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.29”
},
“devDependencies”: {
@ionic/app-scripts”: “^3.2.3”,
“typescript”: “~2.6.2”
},
“description”: “An Ionic project”,
“cordova”: {
“plugins”: {
“cordova-plugin-whitelist”: {},
“cordova-plugin-statusbar”: {},
“cordova-plugin-device”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-ionic-webview”: {},
“cordova-plugin-ionic-keyboard”: {},
“cordova-open-native-settings”: {},
“cordova-plugin-add-swift-support”: {},
“cordova-plugin-geofence”: {
“GEOFENCE_ALWAYS_USAGE_DESCRIPTION”: “{EXECUTABLE_NAME} Would Like to Use Your Current Location Even In Background.", "GEOFENCE_IN_USE_USAGE_DESCRIPTION": "{EXECUTABLE_NAME} Would Like to Use Your Current Location When In Use.”
}
},
“platforms”: [
“ios”,
“android”
]
}
}

As you can see below there are no any error :

Ionic 4 devapp debugging

$
0
0

ionic serve --devapp
This doesn’t work anymore. I have the following error:

> ng run app:ionic-cordova-serve --host=0.0.0.0 --port=8100 --cordova-mock --consolelogs --consolelogs-port=53703
[ng] Unknown option: '--consolelogs'
[ng] Unknown option: '--consolelogs-port'

I tried to update ionic CLI, but same thing. Did anyone experience the same thing lately?

Ionic DevApp Feedback Mega-thread

$
0
0

ionic serve --devapp
This doesn’t work anymore. I have the following error:

> ng run app:ionic-cordova-serve --host=0.0.0.0 --port=8100 --cordova-mock --consolelogs --consolelogs-port=53703
[ng] Unknown option: '--consolelogs'
[ng] Unknown option: '--consolelogs-port'

I tried to update ionic CLI, but same thing. Did anyone experience the same thing lately?

Sending files through MMS

$
0
0

Hey, I was wondering if anyone has a solution for sending files, vcard format to be exact, through MMS?

I’ve tried using the sms plugin and the social sharing plugin but neither of them are what I’m looking for.

There are sms plugin forks in github that will support images but not other files.

Any advice is appreciates. Thank you for reading my post.

TL;DR:
Plugin for sending vcard through mms?

Can`t refresh changes in my debug.apk

$
0
0

Hello everyone, I would like to know if someone has had a problem with updating changes in the debugable file “app.debug.apk” and how you have solved them,because in my case I make updates and recreate that file and when testing it in a physical device it shows it as if no change had been made.

Photo-gallery tutorial - theme page does not exist

$
0
0

:open_mouth:

Not Found

Sorry, we couldn’t find that page.

Photo-gallery tutorial - theme page does not exist


How i can storage http respons?

$
0
0

Adjust your expectations, for this is the way things are. Your intuition that asynchronous programming is involved is spot-on, but if you view this as a “problem”, you’re in for a lot of frustration.

It’s hard to give specific recommendations without knowing that you’re really trying to achieve with getLat - for example, if you’re trying to reference them from a template, then the AsyncPipe is a tool you might like.

In general, though, you need to incorporate in your designs the fact that Ionic applications, like most modern web apps, tend to prioritize responsiveness over predictability. The code inside your subscribe block will be executed when the underlying network request returns. Nothing outside that block has any clue when that will be unless you explicitly make the effort to tell it, and frequently that effort isn’t really worth it.

If you’re using this information to display a marker on a map, for example, do the things required to spawn the marker inside the subscribe block, so the user sees “no marker” and then “marker where it is supposed to be”. If you’re displaying it as text, think about a placeholder such as “loading…”. If the whole page simply can’t display at all until this data comes in, then think about popping a loading overlay or investigating route resolvers.

Saving items in array and retrieving array in different page

$
0
0

I would suggest going through the Tour of Heroes, paying especially close attention to chapter 4 about services. That entire tutorial builds out an app very similar to what you describe.

Admob auto close in note9, note 8

$
0
0

Hi, my admob ads are acting funny. They just auto close them self. At first they pup up as it should but automatically closes it self just after opening. But I have not change any code, it started to happen around 2 weeks ago. It was working just fine but all of my playstore app suffers from this not just one.
But i heard from the user, it is auto closing in note 9,note 8 but shows ads on s7 edge, Redmi note 4…

This is my one app


Why ads are auto closing?

File Downloader Plugin throwing error of 'no class found'

$
0
0

I have been attempting to use file transfer plugin and downloader plugin for the ionic native but each time i click on the download it will return with no class found. in spite of repetitive installation of both Cordova plugins. I want to be able to download a file from a remote server
based on this
file downloader

import { Downloader } from '@ionic-native/downloader/ngx';


constructor(private downloader: Downloader) { }

...

   var request: DownloadRequest = {
          uri: YOUR_URI,
          title: 'MyDownload',
          description: '',
          mimeType: '',
          visibleInDownloadsUi: true,
          notificationVisibility: NotificationVisibility.VisibleNotifyCompleted,
          destinationInExternalFilesDir: {
              dirType: 'Downloads',
              subPath: 'MyFile.apk'
          }
      };


  this.downloader.download(request)
              .then((location: string) => console.log('File downloaded at:'+location))
              .catch((error: any) => console.error(error));

How i can storage http respons?

$
0
0
constructor{
        this.http.get(this.url).subscribe(
          data => {
            this.post = data;
          });
      }
 ngAfterContentInit{
console.log(this.post); //gives undefined
}

console.log(this.post); works before this.post = data; Is it possible to completely execute http.get before ngAfterContentInit?

Viewing all 228554 articles
Browse latest View live


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