我正在使用Ionic 3,我有一些要求用户进行身份验证的功能,因此当用户点击按钮时,会显示警报.由于这些功能遍布整个项目,所以我创建了一个全局函数,显示了这个警告,但当我把它放入push()或setRoot()时,项目停止工作并出现一个空白页面.
import { Injectable, ViewChild } from '@angular/core';
//..............
@Injectable()
export class Alerts {
@ViewChild(Nav) nav: Nav;
constructor(private alertCtrl: AlertController) {
}
mustLogin() {
let alert = this.alertCtrl.create({
title: 'must login',
message: 'go to login ?',
buttons: [
{
text: 'Cancel',
role: 'cancel',
handler: () => {
console.log('Cancel clicked');
}
},
{
text: 'Login',
handler: () => {
this.nav.setRoot(LoginPage);
//this.nav.push(LoginPage); blank page also
}
}
]
});
alert.present();
}
Run Code Online (Sandbox Code Playgroud)
}
当我运行"ionic cordova platform add ios"时,出现以下错误.怎么解决?
Exception: Using cordova-fetch for cordova-ios@0.0.1
Error: Failed to fetch platform cordova-ios@0.0.1
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for cordova-ios@0.0.1
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist. …Run Code Online (Sandbox Code Playgroud) 我正在使用离子离子图标
<ion-icon name="checkmark" [class]="condition ? 'class1' : ''"></ion-icon>
如果条件为true,我想添加一个额外的类,但如果条件为false,则不要添加该额外的类。
问题是,如果条件为假,它将从Ionic Framework中删除图标上的所有预定义类。
在尝试在我的项目中使用google变量后,有人可以帮助我解决此错误,并在Ionic 3应用程序中获取该错误,
npm install --save @ types / google-maps
这将以下内容添加到我的package.json中:
“ @ types / google-maps”:“ ^ 3.2.0”,
我也确实声明了声明var google;
并且做了 typings install dt~google.maps --global
然后我看到了这个灵魂,并尝试了一下,但是还是不起作用(注意,我生成了一个ios键和android键),尝试了这个 找不到名称空间“ google”
ionic cordova插件添加 https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID =“ YOUR_ANDROID_API_KEY_IS_HERE” -variable API_KEY_FOR_IOS =“ YOUR_IOS_API_KEY_IS_HERE” $ npm install --save地图
要点就是我的map.ts多数民众赞成在拍摄此错误:
https://gist.github.com/abdulfatah-ah1407281/25bc95352d0b1ba8e02b7d1e55cc7779
当我运行离子服务时出错:
Cannot find namespace 'google'.
C:/Users/pkhon/Desktop/k/ItBroken/src/components/map/map.ts
private map: google.maps.Map;
public isMapIdle:boolean;
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用cordova-plugin-googleplus插件。
我读过其他文章,说要将该插件添加为提供程序,并且尝试这样做无济于事。
当我尝试访问登录页面时,出现带有堆栈跟踪的错误:
未发现运行时错误(承诺):错误:没有GooglePlus提供商!错误:没有GooglePlus提供商!在ReflectiveInjector_处的noProviderError(http:// localhost:8100 / build / vendor.js:1628:12)处,在injectionError(http:// localhost:8100 / build / vendor.js:1590:86)处。在ReflectiveInjector处抛出throwOrNull(http:// localhost:8100 / build / vendor.js:3129:19)。ReflectiveInjector上的getByKeyDefault(http:// localhost:8100 / build / vendor.js:3168:25)。ReflectiveInjector .get(http:// localhost:8100 / build / vendor.js:2969:21处的getByKey(http:// localhost:8100 / build / vendor.js:3100:25)),位于AppModuleInjector.getInternal(ng:///AppModule/module.ngfactory.js:615:44)的AppModuleInjector.get(ng:///AppModule/module.ngfactory.js:332:145)。在LoginPageModuleInjector.NgModuleInjector.get 获取(http:// localhost:8100 / build / vendor.js:3936:44)(http:// localhost:8100 / build / vendor.js:3937:52)
堆栈跟踪
Error: Uncaught (in promise): Error: No provider …Run Code Online (Sandbox Code Playgroud) 我正在使用新的Ionic Pro.我已将以前工作的离子应用程序迁移到新的Pro服务中.我现在能够成功地将我的代码推送到我的离子pro git repo,我可以在仪表板上看到构建日志.构建成功完成.完成后,我导航到所述构建的"包"选项卡.我配置我的包以编译platform = Android version = Release Security Profile = Android Release安全配置文件.
此时的输出日志将在安装过程中移动,并获得以下控制台输出.
BUILD SUCCESSFUL
Run Code Online (Sandbox Code Playgroud)
然后,构建过程似乎启动Gradle Daemon并最终以此输出结束
The Task.leftShift(Closure) method has been deprecated and is scheduled to
be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at
Run Code Online (Sandbox Code Playgroud)
无法加载文件/home/gitlab-runner/.android/repositories.cfg.在/ opt/android-sdk/licenses中检查包Android SDK平台26的许可证接受包Android SDK平台26的许可证.准备"安装Android SDK Platform 26".警告:无法读取或创建安装属性文件.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Failed to install the following SDK components:
[Android SDK Platform 26]
The SDK directory (/opt/android-sdk) …Run Code Online (Sandbox Code Playgroud) 我有一个输入字段,用户可以输入他的地址并获得自动建议:
<ion-label color="primary" stacked>Adresse:</ion-label>
<ion-input type="text" ng-model="autocomplete.query" ng-change="updateSearch()"></ion-input>
Run Code Online (Sandbox Code Playgroud)
我的班级有一个更新方法,我想做点什么,但不幸的是他没有进入它.
updateSearch()
{
console.log('aaa');
if (this.autocomplete.query == '') {
this.autocompleteItems = [];
return;
}
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
在我单击离子应用键盘中的“发送”按钮后,它被隐藏了。我的代码:
<ion-item>
<ion-labe>Text</ion-label>
<ion-textarea [(ngModel)]="text" placeholder="Write a Message …"></ion-textarea>
</ion-item>
<a (click)="sendMessage();">Send</a>
Run Code Online (Sandbox Code Playgroud)
单击操作后,我需要键盘保持打开状态。请帮帮我。
我只是按照这些说明努力让我的应用程序加载我的应用程序(它挂在启动画面上).
总之,我这样做了:
npm install -g ionic@latest
npm install ionic-angular@3.7.0 --save
npm install @ionic/app-scripts@3.0.0 --save-dev
npm install @angular/core@4.4.3 --save
npm install @angular/common@4.4.3 --save
npm install @angular/compiler@4.4.3 --save
npm install @angular/compiler-cli@4.4.3 --save
npm install @angular/forms@4.4.3 --save
npm install @angular/http@4.4.3 --save
npm install @angular/platform-browser@4.4.3 --save
npm install @angular/platform-browser-dynamic@4.4.3 --save
npm install rxjs@5.4.3 --save
npm install zone.js@0.8.17 --save
Run Code Online (Sandbox Code Playgroud)
现在,当我跑步时,ionic package build ios我得到这些错误:
[14:21:32] typescript: node_modules/@angular/platform-browser/animations/src/animation_builder.d.ts, line: 8
Module '"/Users/eamonwhite/ionicmane/myApp/node_modules/@angular/animations/animations"' has no exported
member 'AnimationBuilder'.
L7: constructor(rootRenderer: RendererFactory2, doc: any);
L8: …Run Code Online (Sandbox Code Playgroud) 我的应用程序中有一些聊天功能,当输入新消息时,它会自动滚动到底部<ion-content>,但是,就像许多聊天应用程序一样,如果您在聊天中向上滚动以阅读最新消息之前的内容,我不想滚动.只有当用户位于屏幕的最底部时,我才会在新消息进入后滚动到底部.我还没有解决这个问题.
这是我目前的代码:
scrollToBottom() {
// If the scrollTop is greater than the height, we are at the bottom,
// in which case, show scrolling animation
let dimensions = this.content.getContentDimensions();
let scrollHeight = dimensions.scrollHeight;
let scrollTop = dimensions.scrollTop;
let contentHeight = dimensions.contentHeight;
let heightAndScrollTop = contentHeight + scrollTop;
// This is the best I can get, assuming that the screen is in a consistent dimension, which we all know is basically non-existent due to all the different types of …Run Code Online (Sandbox Code Playgroud) ionic-framework ×10
ionic2 ×6
angular ×4
ionic3 ×4
typescript ×3
cordova ×2
ios ×2
angularjs ×1
build ×1
ionic-native ×1
node.js ×1
transpiler ×1