ionic-framework

Angular - wait for this variable to have value and then execute

霸气de小男生 提交于 2021-02-10 14:13:45
问题 In ngOnInit() , first line of code fetches the value from local storage and then that value is used to filter data from database. Both executes together and I don't get the result. How can I do something like the second function waits for the first one to get value. Below is my ts code: ngOnInit() { //get id of user this.storage.get('loggedInUser').then((val) => { console.log('Your user ID is', val); this.loggedInusr = val; }); firebase.firestore().collection(`todos`) .where("assignTo", "==",

Why, using @HostListener, keypress event fires a number of time equal of the times the page is visited (ionic2/typescript)?

点点圈 提交于 2021-02-10 14:13:36
问题 I have a page in ionic 2 and I want to catch key pressed when the user is in the page. This is the code I used to do this (.ts) @Component({ selector: 'page-play', templateUrl: 'play.html' }) export class PlayPage { @HostListener('document:keypress', ['$event']) handleKeyboardEvents(event: KeyboardEvent) { console.log("keypressed!"); } constructor() { // doing a lot of things } } Unfortunately, the handleKeyboardEvents gets fired once the first time I enter in the page, twice if, after that,

angular material md-datepicker not working in an ionic modal

好久不见. 提交于 2021-02-10 12:03:37
问题 I am attempting to use an angular material md-datepicker within an ionic modal and am not having the ng-change event being fired when the datepicker is used and date is changed,the datepicker itself won't scroll, and doesn't seem clickable. When I have tried using the datepicker outside of the modal, all works correctly. What is going on here? <script id="add-location-modal.html" type="text/ng-template"> <ion-modal-view> <ion-content> <md-content layout-padding> <form name="myForm" style="">

'rm' is not recognized as an internal or external command when trying publish a capacitor plugin

跟風遠走 提交于 2021-02-10 03:59:26
问题 I am trying to publish a capacitor plugin. According to the error it is not able to recognize rm . I am using Window's Powershell (VC Code) The following error is being generated in the powershell when npm publish in run PS C:\Users\xxxxx\Documents\demo-plugin> npm run build demo-plugin@0.0.1 build C:\Users\xxxxx\Documents\demo-plugin npm run clean && tsc demo-plugin@0.0.1 clean C:\Users\xxxxxx\Documents\demo-plugin rm -rf ./dist 'rm' is not recognized as an internal or external command,

Ionic Delete File using Native URL

一个人想着一个人 提交于 2021-02-09 11:54:32
问题 I am using CSDK image editor to edit the image. Here is the method to edit the image:- CSDKImageEditor.edit(success, error, imageUrl, options); So on success method editor is returning the image url, that's in native format like:- content://media/23 I need to delete that file after editing. So I am using Cordova File to delete the file. As this is native url so cordova file can't find the file using that url. After going through google I got a plugin Corodva Filepath to convert native url to

Ionic Delete File using Native URL

安稳与你 提交于 2021-02-09 11:54:28
问题 I am using CSDK image editor to edit the image. Here is the method to edit the image:- CSDKImageEditor.edit(success, error, imageUrl, options); So on success method editor is returning the image url, that's in native format like:- content://media/23 I need to delete that file after editing. So I am using Cordova File to delete the file. As this is native url so cordova file can't find the file using that url. After going through google I got a plugin Corodva Filepath to convert native url to

Angular HttpClient authorization header created but disappearing

不问归期 提交于 2021-02-08 15:36:13
问题 Problem I am trying to send Request Headers, specifically, an authorization header. The authorization Header should look something like this: Authorization: Basic NTY2MTI0Og== In a list of headers. Where Basic indicates that it is encoded with base64. I'm positive it does get added to the get request made in Angular: Request in Angular. Although I'm not sure what op is. (btw, I'm not yet allowed to embed the image) This is what it should look like: From the standard Datasnap Delphi project

TypeError : callback is not a function

别等时光非礼了梦想. 提交于 2021-02-08 12:13:48
问题 i get a callback is not a function only when i try to add a new parameter erreur= TypeError: callback is not a function at services.js:72 i tried to add reference to the function when i romoved evrything works fine here's my code at service.js I hope you'll help me. .factory('Payement', function ($http, $ionicLoading) { return { saveContratEtudant: function (_nb_piece1,_nb_piece2,_shortadresse,_govClt,_villeClt,_localiteClt,_voieClt,_cod_logem,_adresse_logem,_govLogem,_gelgLogem, _dateDel,

passing html template and icons on alert ionic 4

蓝咒 提交于 2021-02-08 10:58:33
问题 I have been trying to achieve something like the above in ionic 4 but it seems like there is no hope for me cos it seems I can only use inputs and not a custom HTML & icons been passed on the alert. any idea on how to achieve this pls async presentColor() { const alert = await this.alertController.create({ header: "Choose Color", inputs: [ { name: "Red", type: "checkbox", label: "Red", value: "Red", checked: true }, { name: "Black", type: "checkbox", label: "Black", value: "Black" }, { name:

Ionic app back button causes previous state screens to overlap

廉价感情. 提交于 2021-02-08 10:24:17
问题 I am working on an ionic project and am encountering a strange bug where pressing the back button causes the last two views to display at the same time. I've been attempting to fix this for a few weeks now with no luck so I'm hoping one of you have encountered this and can help! The app defaults to the state "Initialize" which just checks if the user is logged in already or not. If they are already logged in it throws them to the "Home" state. If they are not logged in it puts them at the