我有一个popover,它将我带到另一个页面,在那里我弹回到根页面(popToRoot),在事件上重新加载数据/ dom,然后在json数据从服务器返回时解除promise中的弹出窗口.如果我在解雇时有很长的超时,一切正常.
dismissPopup() {
if (this.popover) {
let that = this;
setTimeout(function () {
that.popover.dismiss();
}, 500);
}
}
Run Code Online (Sandbox Code Playgroud)
如果我将超时设置得太低,比如说100毫秒,它就不会消失,因为dom仍在加载.
但是,我不认为暂停可能是最好的做法.如果有人设计缓慢,时间不够,会发生什么?
有人可以提出任何建议吗?我应该检测dom何时加载,然后调用dismiss?如何检查dom是否已加载?
谢谢
我有一个Ionic 2应用程序,它在我的Rails 5后端进行身份验证.用户登录后,我将他的信息存储在本地存储中.因此,一旦用户打开应用程序并且他之前已经登录过,就应该跳过登录页面.我试图在app.component设置我的根页面时这取决于是否有关于本地存储上的用户的信息,但该storage.get方法似乎是异步的,所以它在我的检查后执行,所以它总是认为它是假的.
我有什么想法可以解决这个问题?
我刚刚将离子2从离子2升级到离子3.但现在它被卡在闪屏上并出现错误:
找不到模块"d3"
这是我的离子信息:
Cordova CLI:6.4.0
Run Code Online (Sandbox Code Playgroud)Ionic Framework Version: 3.0.1 Ionic CLI Version: 2.2.1 Ionic App Lib Version: 2.2.0 Ionic App Scripts Version: 1.3.0 ios-deploy version: Not installed ios-sim version: Not installed OS: Windows 10 Node Version: v6.9.1 Xcode version: Not installed
的package.json
{
"name": "MyApp",
"author": "",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
//dependencies starts here. have updated these according to ionic 3
"@angular/common": "4.0.0", …Run Code Online (Sandbox Code Playgroud) 我试图附加一个内联CSS规则来background-image使用类似的动态变量集constructor:
<div style="background-image: url('{{backgroundImage}}');">
...
</div>
Run Code Online (Sandbox Code Playgroud)
然后在我的组件中:
export class SomeComponent {
backgroundImage = '';
constructor(public navCtrl: NavController, public navParams: NavParams) {
this.backgroundImage = 'https://unsplash.it/200/300' ; }
}
Run Code Online (Sandbox Code Playgroud)
但是,当元素呈现到屏幕时,内省CSS规则将被省略.
我尝试使用Angular ng-style,但它返回"无法绑定到'ng-style',因为它不是'div'的已知属性".
我也尝试styles在我的@Component声明中设置,如本答案中所述,但这不会在我的情况下,因为我需要backgroundImage变量是动态的.
我遵循本指南,了解如何在iPhone Simulator上使用Ionic 3上传图像文件。但是我被控制台打印的错误困住了
{“代码”:5,“消息”:“ ENCODING_ERR”}
代码如下:
this.file.resolveLocalFilesystemUrl(dto.image)
.then((entry: FileEntry) => entry.file(file => {
const reader = new FileReader();
reader.onloadend = () => {
//do something
};
reader.readAsArrayBuffer(file);
}))
.catch(err => console.log(JSON.stringify(err)));
Run Code Online (Sandbox Code Playgroud)
dto.image的值是:
/Users/myUsername/Library/Developer/CoreSimulator/Devices/05972D1E-F805-46E4-B164-BB95F116697A/data/Containers/Data/Application/1096409B-6FA3-4660-97AE-EAF3E2472046/tmp/cdv_photo_013.jpg
我正在使用离子本机文件插件
提前致谢。
嗨我正在使用ngFor在中间开始时创建一组3张幻灯片,所以我保证能够在开始时向左或向右滑动.
当我向右滑动时,我可以简单地听到reachEnd并将另一张幻灯片推到我正在循环的数组中.
但我在开头添加幻灯片时遇到问题.如果我像上面那样做并使用例如array.unshift()或spread来添加项目到开头,视图认为它在位置0并将视图捕捉到新幻灯片.
下面的代码可以工作,但它会将幻灯片更改设置为索引1.
slide = [0,1,2] //example to loop
slideChanged(event) {
if(this.slides.isBeginning()){
this.slide = [this.slide[0]-1, ...this.slide];
this.slides.update();
this.slides.slideTo(1)
}
}
<ion-slides [initialSlide]="1" (ionSlideDidChange)="slideChanged($event)">
<ion-slide *ngFor="let item of slide">
<h1>Slide {{item}}</h1>
</ion-slide>
</ion-slides>
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏!
我需要在一行中显示两个输入字段,如下所示:
但是当我使用时:
<ion-list>
<ion-item>
<ion-label stacked> Phone Number</ion-label>
<ion-grid>
<ion-row>
<ion-col>
<ion-input type="tel" placeholder="Area code"></ion-input>
</ion-col>
<ion-col>
<ion-input type="tel" placeholder="Number"></ion-input>
</ion-col>
</ion-row>
</ion-grid>
</ion-item>
Run Code Online (Sandbox Code Playgroud)
但它没有显示任何屏幕像:
请帮我.
我需要帮助,我在Ioni 3管道有问题,我一直在关注这个线程离子3无法找到管道和这个链接Ionic 3管道全球 但仍然没有运气我得到的是管道分离器无法工作,我正在生成我的管道使用离子g管道分离器我在我的html中使用我的管道
{{string | separator}}
Run Code Online (Sandbox Code Playgroud)
我的separator.ts(自定义管道)
import { Pipe, PipeTransform } from '@angular/core';
/**
* Generated class for the SeparatorPipe pipe.
*
* See https://angular.io/api/core/Pipe for more info on Angular Pipes.
*/
@Pipe({
name: 'separator',
})
export class SeparatorPipe implements PipeTransform {
/**
* Takes a value and makes it lowercase.
*/
transform(value: string, ...args) {
return value.toLowerCase();
}
}
Run Code Online (Sandbox Code Playgroud)
我的pipe.module.ts
import { NgModule } from '@angular/core';
import { SeparatorPipe } from './separator/separator'; …Run Code Online (Sandbox Code Playgroud) 我无法为onesignal插件创建添加ios平台。用android构建它很好。
我这样做:
$ ionic cordova platform add ios
Run Code Online (Sandbox Code Playgroud)
以下错误失败。
apple-ios version check failed ("/Users/megasap/Documents/project/railerdotcom/railercom_parent/platforms/ios/cordova/apple_ios_version"), continuing anyways.
Failed to install 'onesignal-cordova-plugin': undefined
Failed to restore plugin "onesignal-cordova-plugin" from config.xml. You might need to try adding it again. Error: /Users/megasap/.rbenv/shims/pod: line 21: /usr/local/Cellar/rbenv/1.0.0/libexec/rbenv: No such file or directory
--save flag or autosave detected
Saving ios@~4.5.4 into config.xml file ...
[ERROR] Exception:
Run Code Online (Sandbox Code Playgroud)
完整的执行和错误在这里:https : //gist.github.com/axilaris/a926c54eb515bef5eb2f7019e36aa40f
这曾经有用,我只是更新到最新的xcode 9.2来编译其他东西。使用最新的xcode是否有问题?