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

How to change ion-fab-button background color? (ionic 4 beta)

$
0
0

@helenakohan wrote:

Hi:

I want to change the background color of ion-fab-button.

How to do it with scss? I want to change to color white or the hex #eee000.

I am in the ionic 4 beta version and the shadow don won’t let me access the scss:

ion-fab-button button .button-inner { background-color: #eee000 !important; }

How to do it?

10x in adsvance

Posts: 1

Participants: 1

Read full topic


Picking images from photolibrary not working ionic 4

$
0
0

@tihomir619 wrote:

I have a problem , im implementing a picture upload functionability to my app which im developing with ionic 4 , im using the native plugin camera and few others to do the following.

async selectImage() {
    const actionSheet = await this.actionsheet.create({
      header: "Select Image source",
      buttons: [{
        text: 'Load from Library',
        handler: () => {
          this.takePicture(this.camera.PictureSourceType.PHOTOLIBRARY);
        }
      },
      {
        text: 'Use Camera',
        handler: () => {
          this.takePicture(this.camera.PictureSourceType.CAMERA);
        }
      },
      {
        text: 'Cancel',
        role: 'cancel'
      }
      ]
    });
    await actionSheet.present();
  }

  takePicture(sourceType: PictureSourceType) {
    var options: CameraOptions = {
      quality: 100,
      sourceType: sourceType,
      saveToPhotoAlbum: false,
      correctOrientation: true
    };

    this.camera.getPicture(options).then(imagePath => {
      var currentName = imagePath.substr(imagePath.lastIndexOf('/') + 1);
      var correctPath = imagePath.substr(0, imagePath.lastIndexOf('/') + 1);
      this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
    });
  }

  copyFileToLocalDir(namePath, currentName, newFileName) {
    this.file.copyFile(namePath, currentName, this.file.dataDirectory, newFileName).then(success => {
      this.presentToast('Dispongo a actualizar.');
      this.updateStoredImages(newFileName);
    }, error => {
     // this.presentToast('Error while storing file.');
    });
  }
  updateStoredImages(name) {
    this.storage.get(STORAGE_KEY).then(images => {
      let arr = JSON.parse(images);
      if (!arr) {
        let newImages = [name];
        this.storage.set(STORAGE_KEY, JSON.stringify(newImages));
      } else {
        arr.push(name);
        this.storage.set(STORAGE_KEY, JSON.stringify(arr));
      }

      let filePath = this.file.dataDirectory + name;
      let resPath = this.pathForImage(filePath);

      let newEntry = {
        name: name,
        path: resPath,
        filePath: filePath
      };

      this.images = [newEntry, ...this.images];
      this.ref.detectChanges(); // trigger change detection cycle
    });
  }

So in the action sheet when i press the first option ( load from the library ) it opens me thethe library and i can choose the picture without any problem. When i press ok it throws an error , the error from the copyFileToLocalDir promise. However if i do the same with the second option (Use camera) and i take a photo with the camera it loads it fine and i can store it later.

I cant find the problem, please help.

Posts: 1

Participants: 1

Read full topic

EventListener and twice Alert

$
0
0

@ndblackandblue wrote:

Hi everyone, first all, english it’s not my native language, probably i gonna write something wrong here, anyway sorry.

Well, i have a application, its a chat, for some reason after a leave chatPage, this event listener still open in another pages, if a comeback to ChatPage again, he gonna open twice alerts.

ChatPage

ionViewDidLoad(){

  windows.addEventListener(click => (e: any){
   ....
  // its a method to identify weblink in a chat.
  showAlert();
}
}

Posts: 1

Participants: 1

Read full topic

How to implement image upload via REST API in ionic3?

$
0
0

@Roman100 wrote:

hi to all,
I have to implement image upload functionality from gallery fn ionic3 and after image is selected properly and show selected image data but in the html section image is not display and also we have to pass this imagedata from the API but i got invalid param erro from the response of API.
I have used this plugin for image from gallary: https://ionicframework.com/docs/native/camera/
?
i have stuck this issue please check our code tell me what’s wrong in my code?
openGallery() {

let optionsGallery: CameraOptions = {
quality: 100,
sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
}

this.camera.getPicture(optionsGallery).then((imageData) => {
this.base64Image = imageData;
//
var clientConfirmData = new FormData();
clientConfirmData.append(‘image’, this.base64Image);

var  value = clientConfirmData.get('image'); 

console.log(‘sss’ +value);

//postMethod for post data in the API…
this.service.imageUpload(this.service.baseurl()+ ‘update_profile_image’, clientConfirmData).then(data => {
console.log(‘dd’ +data);

},error => {
  console.log(error)
});

}, (err) => {
// Handle error
console.log(err)
})
}

imageUpload(url ,postData) {
let headers = new Headers();
headers.append(‘userid’, this.userId);

return this.http.post(url, postData, {headers:headers}).toPromise()
.then(res => {

  if(res.json().error==460 && res.json().status !=1){
     console.log('res 0000ffff ' +res);
  } else{
    return res.json();  
  }
}, err => {
    console.log('res 0000ffff ' +err);
});

}

Posts: 1

Participants: 1

Read full topic

How to implement image upload via formData and pass in REST API in ionic3?

$
0
0

@RomnEmpire wrote:

hi to all,
I have to implement image upload functionality from gallery fn ionic3 and after image is selected properly and show selected image data but in the html section image is not display and also we have to pass this imagedata from the API but i got invalid param erro from the response of API.
I have used this plugin for image from gallary: https://ionicframework.com/docs/native/camera/
?
i have stuck this issue please check our code tell me what’s wrong in my code?

`openGallery() {

let optionsGallery: CameraOptions = {
     quality: 100,
     sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
    destinationType: this.camera.DestinationType.DATA_URL,
    encodingType: this.camera.EncodingType.JPEG,
    mediaType: this.camera.MediaType.PICTURE

}
this.camera.getPicture(optionsGallery).then((imageData) => {
this.base64Image = imageData;
//
var clientConfirmData = new FormData();
clientConfirmData.append(‘image’, this.base64Image);

//postMethod for post data in the API…
this.service.imageUpload(this.service.baseurl()+ ‘update_profile_image’,
clientConfirmData).then(data => {
console.log(‘dd’ +data);
},error => {
console.log(error)
});
}, (err) => {
// Handle error
console.log(err)
})
}

imageUpload(url ,postData) {
let headers = new Headers();
headers.append(‘userid’, this.userId);

return this.http.post(url, postData, {headers:headers}).toPromise()
.then(res => {

  if(res.json().error==460 && res.json().status !=1){
     console.log('res 0000ffff ' +res);
  } else{
    return res.json();  
  }
}, err => {
    console.log('res 0000ffff ' +err);
});

}`

Posts: 1

Participants: 1

Read full topic

Property 'mybooking' does not exist on type 'AuthService'. Did you mean 'booking'?

$
0
0

@thiruvenganna wrote:

I get this error when i try to load page.

src/account/account.ts

import { Component } from ‘@angular/core’;
import { IonicPage, NavController, NavParams } from ‘ionic-angular’;
import { AuthService } from ‘…/…/providers/auth-service/auth-service’;
/**

@IonicPage()
@Component({
selector: ‘page-account’,
templateUrl: ‘account.html’,
providers: [AuthService]
})
export class AccountPage {

bookings: any;

constructor(public navCtrl: NavController, public navParams: NavParams, public authService: AuthService) {

this.mybooking();

}

mybooking(){

this.authService.mybooking().subscribe((data)=>{
this.bookings = data;
});

}


auth-service.ts

@Injectable()
export class AuthService {

constructor(public http: Http) {}

mybooking() {
return new Promise((resolve, reject) => {
let headers = new Headers();
headers.append(‘Content-Type’, ‘application/json’);

    this.http.get(mybookingurl, JSON.stringify(data), {headers: headers})
      .subscribe(res => {
        resolve(res.json());
      }, (err) => {
        reject(err);
      });
});

}

Posts: 1

Participants: 1

Read full topic

Invoke a function when page is returned

$
0
0

@rigorio wrote:

I basically have two pages. One main page, and then second page.
When I press button A on main page, it invokes the following:
this.navCtrl.push(SecondPage);
And then second page has a back button that will return to main page.
I need to update some values whenever the back button is pressed or if navCtrl returns to main page. The function is found on main page ts. What can be done for this?

Posts: 1

Participants: 1

Read full topic

[IONIC 4] Check page canDeactivate, o can close - routerLink

$
0
0

@proiertti wrote:

I have a sidemenu , and I navigate the pages with a classic routerLink.

How I can check if I can close, and eventually prevent a closing, of a page in ionic4?

thank you

Posts: 1

Participants: 1

Read full topic


Sqlite with Image base64

$
0
0

@KamayaniT wrote:

My aim is to store captured photos or whatever image is selected from gallery in my database for offline management of images. I have created sqlite database but I do not understand how to store base64 image in db
to capture images, I am using Camera plugin
`addPhoto(sourceType)
{

const options: CameraOptions = {
  quality: 100,
  destinationType: this.camera.DestinationType.DATA_URL,
  encodingType: this.camera.EncodingType.JPEG,
  mediaType: this.camera.MediaType.PICTURE,
  correctOrientation: true,
  sourceType:sourceType

}

this.camera.getPicture(options).then((imageData) => {

 // If it's base64 (DATA_URL):
 let base64Image = 'data:image/jpeg;base64,' + imageData;
 console.log(base64Image);
}, (err) => {
 // Handle error
});

}`

Posts: 1

Participants: 1

Read full topic

AngularFireDatabase get list names

$
0
0

@nature225 wrote:

Hey everyone. I had a Firebase Database see with structure (see Screenshot):

27

I want to output ( horro, action and Musikfilme) - how can I do it? my code is this:

this.fdb.list('/kategorien/').valueChanges().subscribe( data => {
      //Todo: output name not key 
      this.arrMedia =  Object.keys(data); 
      console.log("Medien: " + this.arrMedia);
    })

But I become only key ( 0, 1, 2) anyone have ideas?

Posts: 1

Participants: 1

Read full topic

Ionic angularfire need help please

$
0
0

@nature225 wrote:

Hey everyone. I had a Firebase Database see with structure (see Screenshot):

27

I want to output ( horro, action and Musikfilme) - how can I do it? my code is this:

this.fdb.list('/kategorien/').valueChanges().subscribe( data => {
      //Todo: output name not key 
      this.arrMedia =  Object.keys(data); 
      console.log("Medien: " + this.arrMedia);
    })

But I become only key ( 0, 1, 2) anyone have ideas?

Posts: 1

Participants: 1

Read full topic

Some svg icons don't show in device

$
0
0

@ir2pid wrote:

I am importing svgs by adding them in the app.scss like below:

ion-icon {
    &[class*=ic-] {
        // Instead of using the font-based icons
        // We're applying SVG masks
        mask-size: contain;
        mask-position: 50% 50%;
        mask-repeat: no-repeat;
        background: currentColor;
        width: 1em;
        height: 1em;
    }
    // custom icons
        &[class*="ic-check"]{mask-image: url(../assets/img/svg/check.svg); }
        &[class*="ic-copy"]{mask-image: url(../assets/img/svg/copy.svg); }
        &[class*="ic-edit"]{mask-image: url(../assets/img/svg/edit.svg); }
}

rendering them in html like so:


        <ion-icon padding margin name="ic-check"></ion-icon>

the problem is in chrome browser all the icons show up, but on device some icons go missing and the space is left blank.

How can I resolve the issue and is there a better way to import svg icons?

Posts: 1

Participants: 1

Read full topic

Ionic 4 - How to put a component inside another component/page (nested)

$
0
0

@helenakohan wrote:

Hi:

I’m migrating from 2 to 4 beta.

I want to put a component inside another component and it gives me hard time.

in ionic 2 I could easily put in the html of a page/component the selector of a component I created like so:

and it would work like a charm.

Now it gives me this error:

//----------------------------------------------
ERROR Error: Uncaught (in promise): Error: Template parse errors:
‘my-custom-component’ is not a known element:

  1. If ‘my-custom-component’ is an Angular component, then verify that it is part of this module.
  2. If ‘my-custom-component’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.
    //----------------------------------------------

What should I do?

10X in advance:)

Posts: 1

Participants: 1

Read full topic

application not installed

$
0
0

@lb8989547 wrote:

A query at the time of installing the apk made in ionic 3 to my android device I get application not installed

Posts: 1

Participants: 1

Read full topic

Push notifications in a local network

$
0
0

@lefmyh wrote:

I need to implement Push Notifications for Android and iOS using my own server in a local network with no Internet access. More precisely, my users will have a mobile app (Android and iOS) which will connect to a local Server through a wireless network. This network won’t have any Internet connection. The server will need to send push notifications to the connected devices when some concrete events happen.

I’m using Django on the server side.

I’ve been researching a bit and it looks like using XMPP would be a neat solution. Thus I guess I need an XMPP Server to communicate with the mobile devices. I’ve seen several alternatives for the server side, though I don’t understand completely what I need exactly. There are some XMPP servers such as Openfire and SleekXMPP. I’m not really sure what are they for. Should I choose one of them or use both?

On the other side, which alternatives are there in the app side?

What I need basically is some guidance on which technologies to choose and some references.

Posts: 1

Participants: 1

Read full topic


How to create rating functionality

How to hide third party keyboard in ionic

$
0
0

@phyopwint wrote:

Hi all,
I am using ionic 3 to work application. I would like to hide third party keyboard on client phone. basically want to disable option to use third party keyboard. I would like to show only native keyboard. Will it be possible to do that. if yes, what are the recommended ways in ionic framework. Thank you so much.

Regards.

Posts: 1

Participants: 1

Read full topic

Admob Issue

$
0
0

@flycoders_sourav1 wrote:

Hello ionic Expertise
Whenever i used admob plugin and try to build my application showing this error
Execution failed for task ‘:app:transformClassesWithDesugarForDebug’.
how can i fix it. Please help me.
Any help would be appreciated.
Thanks in advance.

Posts: 1

Participants: 1

Read full topic

RTL in Ionic 4 in the SCSS

$
0
0

@CreativeArtDesign wrote:

Before i used this in SCSS in Ionic v3 but this does not work in Ionic 4?

.my-headertext{
  @include ltr() { // ENGLISH
    font-size: 14px;
    font-family: normal-font;
  }
  @include rtl() { // ARABIC
    font-size: 14px;
    font-family: arabiclabel-font;
  }
}

I tried to migrate my Ionic 3 to 4 but get stuck with this issue.

Is there any solution for this?

Posts: 1

Participants: 1

Read full topic

Retrieve all data by users in firebase

$
0
0

@aligassan wrote:

i am try to build blog app using firebase database , l want to allowed to users can they read data post by each others , but unsuccessfully when i used this rules for database

{
  "rules": {
  "report": {
      "$uid": {
        ".read": "true",
        ".write": "$uid === auth.uid"

      }
    }    

  }
}

When l use this rules the users does not read posts for other user ! , only he can read has own post .

main code

   ionViewWillLoad(){
        this.fire.authState.subscribe(data => {
          if(data && data.email && data.uid){

            this.toastCtrl.create({
              message : ` welcome ${data.email}`,
              duration:2000
            }).present()
            this.itemsRef = this.db.list(`report/${data.uid}`);
            // Use snapshotChanges().map() to store the key
            this.items = this.itemsRef.snapshotChanges().pipe(
              map(changes => 
                changes.map(c => ({ key: c.payload.key, ...c.payload.val() }))
              )
            );


          }

        })

      }

enter image description here

how can l retrieve the data for every user

Posts: 1

Participants: 1

Read full topic

Viewing all 48980 articles
Browse latest View live


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