我已将我的 ionic 应用程序从 beta 11 更新到 rc0。所以这意味着我已经从 Angular2 RC4 切换到 Angular2 stable,从 TypeScript 1.8 切换到 2,并使用 rollupjs 模块捆绑器。
我已经根据这篇博客文章配置了 AngularFire2: Ionic 2 RC0、Firebase 3 + AngularFire 2 入门
我无法编译并收到此错误:
rollup:强烈建议不要使用 ofeval(在 c:\XXX\node_modules\angularfire2\node_modules\firebase\firebase.js 中),因为它会带来安全风险,并可能导致缩小问题。 有关更多详细信息,请参阅 https://github.com/rollup/rollup/wiki/Troubleshooting#avoiding-eval
有人知道发生了什么事以及如何解决这个问题吗?
我使用离子幻灯片如下:
<div *ngFor="let category of categories">
<h6 class="slide-title" [innerHTML]="category.name"></h6>
<ion-slides [loop]="true" [pager]="true" [slidesPerView]="3">
<ion-slide *ngFor="let product of category.products">
<img [src]="product.image" class="slide-image">
</ion-slide>
</ion-slides>
</div>
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
未处理的承诺拒绝:模板解析错误:无法绑定到 'slidesPerView',因为它不是 'ion-slides' 的已知属性。
<img [src]="product"): MainPage@12:43 ; 区域: ; 任务: Promise.then ;价值: ....
任何人都可以帮忙吗?
离子 -v 2.2.1
科尔多瓦-v 6.5.0
这是代码:
var x = {};
x.test = 'abc';
Run Code Online (Sandbox Code Playgroud)
获取打字稿编译器错误:
TS2339:类型“{}”上不存在属性“test”。
我想禁止这种警告的对象的文字,我想这将suppressExcessPropertyErrors成为tsconfig.json应该解决这个问题。
配置:
{
"compilerOptions": {
"suppressExcessPropertyErrors": true
},
...
}
Run Code Online (Sandbox Code Playgroud)
但没有任何改变..编译器仍然显示错误。
谢谢你的任何提示;)
我想添加更多数量的标签,有什么解决方案可以在这些标签上滑动吗?
<ion-segment [(ngModel)]="query" (ionChange)="showdata()">
<ion-segment-button value="slide1">
TabTitle1
</ion-segment-button>
<ion-segment-button value="slide2">
TabTitle2
</ion-segment-button>
<ion-segment-button value="slide3">
TabTitle3
</ion-segment-button>
</ion-segment>
Run Code Online (Sandbox Code Playgroud) “细节”在* ngFor从未来的服务器,是它包含列表。我正在从中选择一个项目。我想让该按钮在用户单击时处于活动状态,并且它应该保持活动状态,直到用户从列表中选择另一个选项。我正在使用[ngClass]但它正在激活一个按钮1 到 2秒。
<ion-list>
<button ion-item [ngClass]="configop.selection" *ngFor="let configop of detail" (click)="itemSelected(configop)" >
<div class="ion-item optionalItem">
<div class="ion-button">
<span class="color-code" >
<img src="{{configop.image}}">
</span>
<span class="color-name">{{ configop.name }}</span>
<span class="color-price">{{ configop.price|currency:'PKR':false }}</span>
</div>
</div>
</button>
</ion-list>
.ts file
itemSelected(configop: any) {
if(this.selection !=null){
if(configop.name == this.selection){
this.storage.remove('carPaint');
this.selection=configop.name;
}
else {
this.storage.remove('carPaint');
this.storage.set('carPaint', configop);
this.selection=configop.name;}
}
else { …Run Code Online (Sandbox Code Playgroud) 当我更改变量时,Ionic 2 没有更新我的 UI 有问题。
html:
<ion-card *ngFor="let event of mEvents (click)="onEventCardClick(event)">
<ion-card-content ion-item>
<span class="eventTitle">{{ event.title }}</span> <br/>
<span class="relativeDate">{{ event.getRelativeTimeString() }}</span>
<ion-badge item-end>{{ event.reservationsCount }}</ion-badge>
<ion-badge *ngIf="event.hasUnreadMessages" color="danger" item-end>{{ event.unreadMessagesCount }}</ion-badge>
</ion-card-content>
</ion-card>
Run Code Online (Sandbox Code Playgroud)
从 ts 文件结束:
this.fcm.onNotification().subscribe((notification:NotificationData) => {
if(!this.navCtrl.isActive(this.viewCtrl))
return;
notification.event = JSON.parse(notification.event);
notification.reservation = JSON.parse(notification.reservation);
notification.reservation_message = JSON.parse(notification.reservation_message);
let eventId: number = notification.event.id;
for(let i=0; i<this.mEvents.length; i++) {
if(this.mEvents[i].id == eventId) {
this.mEvents[i].unreadMessagesCount++;
this.mEvents[i].hasUnreadMessages = true;
return;
}
}
});
Run Code Online (Sandbox Code Playgroud)
问题是,我从我的服务器发送了一个推送通知。我成功接收消息并更新相应的对象(事件)。但是最后一个ion-badge元素 inion-card没有出现。它仍然是“隐藏的”。但是,如果我与 …
我们正在创建 Ionic-Native 移动应用程序。我们正在使用 ToastController ( ToastController )。我们使用position: 'top'。但它与状态栏重叠。所以我们想要自定义位置。我们试过这样
let Errortoast = this.toastCtrl.create({
message: 'Please try again later',
duration: 3000,
cssClass: 'toast',
position: 'top'
});
.toast{
margin-top: 70px;
}
Run Code Online (Sandbox Code Playgroud)
但没有运气。自定义位置的任何想法?。
我想以弹出模式以编程方式打开 ionSelect。
@ViewChild('selectNotificationList') selectNotificationList: IonSelect;
Run Code Online (Sandbox Code Playgroud)
打开离子选择的方法是:
clickNotificationNumber() {
this.selectNotificationList.interface = 'popover';
this.selectNotificationList.open();
}
Run Code Online (Sandbox Code Playgroud)
HTML是:
<ion-card slot="end" class="langCard">
<ion-card-content>
<ion-select interface ="popover" (ionChange)="readNotification($event)" #selectNotificationList>
<ion-select-option *ngFor="let message of notificationList let notificationIndex = index" value="{{message.id}}">
{{message.notificationOptions.body}}</ion-select-option>
</ion-select>
</ion-card-content>
</ion-card>
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建一个 ionic 项目,当我尝试使用该命令时,
ionic capacitor run android
我收到一条错误消息,
[error] Unable to find node_modules/cordova-plugin-whitelist. Are you sure cordova-plugin-whitelist is installed?
[ERROR] An error occurred while running subprocess capacitor.
我已检查是否安装了cordova-plugin-whitelist,它是
Plugin "cordova-plugin-whitelist" already installed on android.
Adding cordova-plugin-whitelist to package.json
如何解决这个问题的?
ionic2 ×10
angular ×5
typescript ×3
ionic3 ×2
ionic4 ×2
angularfire2 ×1
angularjs ×1
css ×1
firebase ×1
html ×1
ion-slides ×1
javascript ×1
rollupjs ×1