我的离子2 /角度2应用程序有问题.
我得到了一个应用程序,其中"auth"部分是实现的.
代码如下所示:
import {Nav, Platform, Modal, ionicBootstrap} from "ionic-angular";
import {NavController} from "ionic-angular/index";
import {StatusBar} from "ionic-native";
import {Component, ViewChild} from "@angular/core";
import {AngularFire, FirebaseListObservable, FIREBASE_PROVIDERS, defaultFirebase} from "angularfire2";
import {HomePage} from "./pages/home/home";
import {AuthPage} from "./pages/auth/home/home";
@Component({
templateUrl: "build/app.html",
})
class MyApp {
@ViewChild(Nav) nav: Nav;
authInfo: any;
rootPage: any = HomePage;
pages: Array<{title: string, component: any}>;
constructor(private platform: Platform, private navCtrl: NavController, private af: AngularFire) {
this.initializeApp();
this.pages = [
{ title: "Home", component: HomePage } …Run Code Online (Sandbox Code Playgroud) 我在工作中ionic 2 beta 11的IOS平台上运行使用的应用程序后ionic run ios一white screen出现,得到了以下信息:
Native: deviceready did not fire within 2000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.
Run Code Online (Sandbox Code Playgroud)
有什么建议吗?究竟是什么问题?
我希望创建一个6页的Ionic 2应用程序,我不确定是否为各个类别页面使用管道或过滤器以及我需要执行此操作的代码.
每个类别页面都可以加载"applecat"类别定义的相关产品.以下是API,通过Google表格以电子表格格式显示产品以及非常快速的主页样机构思:
https://sheetsu.com/apis/v1.0/04c2d2906a10 https://docs.google.com/spreadsheets/d/1RNLXsxTFymqRwq_S538qX1p1PAEDIEA6s5sV8etkfLU/edit?usp=sharing
概述
6页
情景(潜在的用户流程)
用户打开应用程序,点击Home然后Ipad类别链接(加载所有Ipad产品)然后回到Home决定点击All(加载所有产品),后面点击另一页....
问题
它会将2个阵列加载到内存/控制台吗?类别页面是否应使用过滤器或管道?代码应如何查找与现有API调用和产品列表数组相关的管道/过滤器?
PROVIDERS
getRemoteData(): any{
return this.http.get('https://sheetsu.com/apis/v1.0/04c2d2906a10')
.map(res => res.json());
}
Run Code Online (Sandbox Code Playgroud)
列表页面
@Component({
selector: 'page-master',
templateUrl: 'master.html',
providers: [Sheetsu]
})
export class MasterPage {
// declare publicly accessible variable
public sheetsuData: any;
constructor(public navCtrl: NavController, public navParams: NavParams, public sheetsuService: Sheetsu) {}
ionViewDidLoad() {
this.sheetsuService.getRemoteData()
.subscribe(response => {
// assign variable (async) …Run Code Online (Sandbox Code Playgroud) 我试图设置#name1如下所示的值.但它显示编译时错误,如下所示.您能告诉我如何设置text组件的值?在这里,我使用单向数据绑定和模板驱动方法.
[ts]'ElementRef'类型中不存在属性'value'.
html的
<ion-input type="text" name="{{question?.name}}" #name1="ngModel" ngModel> </ion-input>
Run Code Online (Sandbox Code Playgroud)
.TS
@ViewChild('name1') name1: ElementRef;
constructor(){
}
getAnswer(){
this.name1.value = 'Hello';//here it shows the above error
}
Run Code Online (Sandbox Code Playgroud) 我尝试滚动到固定位置,例如scrollTo(500,20).假设您使用的设备宽度为300像素.滚动目标现在已超出屏幕范围,您必须向右滚动.
我通过以下方式解决了这个问题:
<ion-content>
<ion-scroll scrollX="true" style="width:100%; height:100%; white-space: nowrap; ">
<div style="width:1000px; ">
[box1] [box2] [box3] [...]
</div>
</ion-scroll>
</ion-content>
Run Code Online (Sandbox Code Playgroud)
到这里一切都很好.如果我想通过按下按钮向右跳500像素,问题就开始了.向右滑动即可.我知道有一个功能可以做到这一点<ion-content>:
@ViewChild(Content) content: Content;
[...]
this.content.scrollTo(500, 500, 500);
Run Code Online (Sandbox Code Playgroud)
不幸的是,这不适用于我的情况.我认为问题是内容与设备大小有关,因此scrollTo()方法不会生效<ion-scoll>.如何使用scrollTo()方法<ion-scroll>代替<ion-content>?
谢谢你的帮助!
你如何与Firestore进行廉价的连接?
在Firebase中,我会.map()响应并根据存储在每个项目上的外键获取其他数据.但是,考虑到每个读取支付的Firestore的定价模型,这似乎太昂贵了.你怎么看?
在我的情况下,我的关系是针对少数几个类别(约5 - 7)的许多行为.每个动作属于一个类别.
这种情况的最佳做法是什么?我应该像Firebase一样继续这样做吗?或者我应该独立获取两个集合并在Javascript中加入它们?
的Jakub
PS你如何实际使用参考数据类型?遗憾的是,文档中未对此进行描述.
在尝试使用Admob Free插件展示广告时,我遇到了Ionic 3的问题.我的广告只会以测试模式显示(isTesting:true).如果我将其设置为false或评论该行,则没有广告...
这是我的代码:
showBannerAd(){
const bannerConfig: AdMobFreeBannerConfig = {
id:'BANNER-ID',
autoShow: true,
isTesting: false
}
this.adMob.banner.config(bannerConfig);
this.adMob.banner.prepare().then(()=>{
//this.adMob.banner.show();
}).catch(err => console.log(err));
}
Run Code Online (Sandbox Code Playgroud)
如果我取消注释this.adMob.banner.show()行来强制广告,则只会显示黑色单位.
我认为它可能与我的项目有关,所以我甚至开始了一个空白的项目,结果是一样的.
以前有人修过吗?谢谢!!!
我无法使它工作.弹出调用代码是
presentPopover(myEvent){
//alert('invoke popup')
let popover = this.popoverCtrl.create(PopoverPage, this.data);
popover.present(
{
ev: myEvent
}
);
}
Run Code Online (Sandbox Code Playgroud)
我目前需要访问的部分是:
export class PopoverPage{
constructor(public viewCtrl: ViewController) {
// alert('in the popup')
//alert(this.data)
}
Run Code Online (Sandbox Code Playgroud)
那么如何将数据放在popupover页面组件中呢?
离子的背景地理定位插件未更新.我想要的功能是每30秒向插件询问一个lat lng值(如果可用).问题是,它只是给我最初的值,然后背景停止.前景很好,它确实是背景.基本上我无法在后台第一次初始发送后发送请求.
gps.ts
startTracking() {
console.log('started tracking')
const config: BackgroundGeolocationConfig = {
desiredAccuracy: 10,
stationaryRadius: 20,
distanceFilter: 30,
debug: false, // enable this hear sounds for background-geolocation life-cycle.
stopOnTerminate: false
};
this.backgroundGeolocation.configure(config)
.subscribe((location: BackgroundGeolocationResponse) => {
this.zone.run(() => {
this.lat = location.latitude
this.lng = location.longitude
this.bearing = location.bearing
this.speed = location.speed
this.accuracy = location.accuracy
this.timestamp = location.time
})
this.backgroundGeolocation.finish(); // FOR IOS ONLY
this.backgroundGeolocation.stop()
});
this.backgroundGeolocation.start();
}
sendGPS(){
this.optionsService.sendGPS(gpsData).subscribe(result => {
}
})
}
stopTracking() {
this.sendGPS()
}
Run Code Online (Sandbox Code Playgroud)
app.component.ts
constructor(){ …Run Code Online (Sandbox Code Playgroud) 我昨天更新了我的xcode版本,现在当我在验证ipa时遇到以下错误之前构建一个完美运行的离子应用程序:
由于以下错误,此时无法处理应用程序:缺少供应配置文件 - 应用程序必须在名为embedded.mobileprovision的文件中包含供应配置文件.
如何生成/包含embedded.mobileprovision?
谢谢,Yuval
ionic3 ×10
angular ×7
ionic2 ×6
typescript ×3
cordova ×2
admob ×1
firebase ×1
javascript ×1
xcode ×1