ionic-framework

npm ERR! Unexpected end of JSON input while parsing near '…registry.npmjs.org/@i'

僤鯓⒐⒋嵵緔 提交于 2020-07-19 05:15:11
问题 I am new to ionic and i am still trying to install it. Everytime i write an ionic command like npm install -g ionic cordova i receive this error npm ERR! Unexpected end of JSON input while parsing near '...de":"0.6.2","express"' npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\DwayneT\AppData\Roaming\npm-cache\_logs\2019-05-31T01_51_23_542Z-debug.log ' this is my log file 0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', 1 verbose

Preflight response is not successful with proper headers

旧巷老猫 提交于 2020-07-19 04:31:34
问题 I'm having issue getting my ionic app to POST to my API. On my api I have set the following headers: header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Headers: Content-Type"); header("Access-Control-Allow-Methods: GET,PUT,POST,DELETE,OPTIONS"); When posting from Postman or the actual website, everything functions as expected and I see these headers come back but once I open up my app and send a request, it no longer works. GET Requests are working fine, it's just POST

Ionic Scroll To Specific List Item

萝らか妹 提交于 2020-07-18 16:14:49
问题 Is there a way to scroll to a specific item in a ion-list? For example in this codepen: https://codepen.io/anon/pen/grEBQJ When I Go to test button, I want to scroll to the list item with the text "Text". <button ng-click="goTo()">Go to test</button> <ion-list class="item">Test</ion-list> I didn't find any examples so goTo is just blank: $scope.goTo = function(){ } 回答1: You have to set an id to list element like : <ion-item id="item{{item.id}}" ng-repeat="item in items"> Item {{ item.id }} <

How to properly configure a Ionic module in an Angular mono-repo (aka multi-module project)?

拟墨画扇 提交于 2020-07-10 10:25:07
问题 Setting up angular.json and tsconfig.json is quite obvious after a few tries on ng new my-workspace --create-application=false , ng g library , ng g application and merging output of ionic start mys-app into files generated by angular-cli. My main concerns are: what should package.json files look like in workspace root folder and in Ionic project folder? how can I define versions once for plugins in several Ionic apps? 来源: https://stackoverflow.com/questions/62766246/how-to-properly-configure

ngx translate not working on iOS device

∥☆過路亽.° 提交于 2020-07-09 13:54:26
问题 I have an ionic 3 project and I want to use ngx translate. It works in the browser and the iOS simulator but not on a real device (tested on iPhone SE, iOS 11.1). app.module.ts import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { HttpClient, HttpClientModule } from '@angular/common/http'; export function HttpLoaderFactory (http: HttpClient) { return new TranslateHttpLoader(http, './assets/i18n/', '

How to drag elements in Ionic 4/5

这一生的挚爱 提交于 2020-07-09 11:49:05
问题 I would like to create draggable (free) buttons in Ionic. In ionic 3 I used a directive to do this (link https://www.joshmorony.com/building-an-absolute-drag-directive-in-ionic-2/) but this directive don't works in ionic 5 and it does not give any errors. What do you think is the best library (supported from some tutorial) for ionic 5 to do this? Thanks in advance. 回答1: This does not have to be Ionic specific. If you are using angular you can just use an NPM component such as https://www

ion-button Click not firing up function in ionic 4

你说的曾经没有我的故事 提交于 2020-07-09 06:02:12
问题 I have a button and a function in my ionic 4 Code. Ideally on the click of the button, the function should fire up but that's not happening. MY HTML <ion-content padding> <div class="contentFlow" id="profile-content"> <h1>Profile</h1> <ion-button (click)="clicked()" expand="block" color="light"> Logout </ion-button> </div> </ion-content> MY TS: clicked() { alert('hello'); } Note: I need to keep the div in my code. What should I do? 回答1: I have seen such things when the rendering of elements

Ionic3 - Can't bind to 'textMask' since it isn't a known property of 'ion-input'

一个人想着一个人 提交于 2020-07-07 18:59:45
问题 I am trying to use textMask on ionic 3, but it's not working I am getting error message (Can't bind to 'textMask' since it isn't a known property of 'ion-input') . I am following Joshmorony's tutorial https://www.joshmorony.com/improve-mobile-form-ux-with-input-masks/ Click here to see the error message app.module.ts import { TextMaskModule } from 'angular2-text-mask'; @NgModule({ imports: [ FormsModule, TextMaskModule ], contact.html <ion-input type="tel" [(ngModel)]="phoneNumber" [textMask]

How to get the version of ionic framework?

徘徊边缘 提交于 2020-07-04 05:36:11
问题 I wonder how to check the version of ionic. If I do ionic -v I get back 1.4.3 Can that be? Wasn't 1.0.0 just released? 回答1: That is the version number of the Ionic CLI, which is different from the version number of Ionic's library. Here are a couple easy ways to check the version. In the browser console, you can run ionic.version and it will print to the console what version it is. You can also look at the bower.json file in your app, and it will show the version number like you see here.

host-context not working in Angular

两盒软妹~` 提交于 2020-06-27 12:45:15
问题 The button background is red, when it should be green i.e. the conditional styling controlled by :host-context is not activated? Child component styles commander.scss commander { button { background-color: red; } :host-context(.enough-space) .btn-theme { background-color: green; } } Child component template commander.html <button class="btn-theme" (click)="demand()">{{requestText}}</button> Host component template front.html ... <commander (command)="requestPage()" [requestText]="requestText"