我正在使用Ionic 3/Angular 4开发桌面和移动PWA.我将它发布在亚马逊的https服务器上.该应用程序通过桌面浏览器,移动浏览器或移动设备中的主屏幕图标打开.
当我发布新版本并在桌面浏览器中打开地址时,我会获得最新版本的应用程序.当我发布新版本并通过移动浏览器或主屏幕图标打开它时,我得到了我的应用程序的旧版本.
我认为PWA应该自己管理它的版本.
我怎么能强制在移动设备上更新我的应用程序?
我想用share()用subscribe(),但得到错误信息如下.最初,我开始订阅.怎么能解决这个问题?
我的目的是在订阅中执行逻辑.需要共享以防止使用异步管道进行多次调用.
类型'订阅'不能分配给'Observable'类型.
"订阅"类型中缺少"_isScalar"属性.(属性)PostDetailPage.post:Observable
this.post = this.data.getPostById(this.postId).share().subscribe(data => {
this.post = data;
},
err => {
console.log("Oops!");
})
Run Code Online (Sandbox Code Playgroud) 我EventFeedbackComponent通过ModalController 显示一个Component .现在我想订阅一个Subjectin EventFeedbackComponent.如何访问组件实例,以实现我的目标.
我目前的代码:
let modal = this.modalCtrl.create(EventFeedbackComponent);
modal.present();
// This is not working. Throws the error "ERROR TypeError: Cannot read property 'subscribe' of undefined"
modal._component.feedbackSubmit.subscribe(feedbackResponse => {
console.log(feedbackResponse);
});
Run Code Online (Sandbox Code Playgroud)
文档在这方面没有帮助:https://ionicframework.com/docs/api/components/modal/ModalController/
我的用例:
Service,我需要获得反馈.EventFeedbackComponent 有控件来获取单个事件的反馈.feedbackSubmit通过来监听事件Subjectfeedback,我会显示一个成功Toast并在Service中切换我的服务变量以显示下一个事件.我Angular SVG round progressbar为我的离子项目阅读并安装了这个,但它对我不起作用,
https://github.com/crisbeto/angular-svg-round-progressbar
如何正确添加此页面?请帮我解决这个显示此错误
Run Code Online (Sandbox Code Playgroud)Error: Template parse errors: Can't bind to 'current' since it isn't a known property of 'round-progress'. 1. If 'round-progress' is an Angular component and it has 'current' input, then verify that it is part of this module. 2. If 'round-progress' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component压制此消息.3.要允许任何属性将"NO_ERRORS_SCHEMA"添加到此组件的"@NgModule.schemas".("
Run Code Online (Sandbox Code Playgroud)<round-progress [ERROR ->][current]="48" [max]="100"></round-progress> </ion-content> ")
谢谢
我的页面为我添加了home.html
<round-progress
[current]="current"
[max]="max"
[color]="'#45ccce'"
[background]="'#eaeaea'"
[radius]="125"
[stroke]="20"
[semicircle]="true"
[rounded]="true" …Run Code Online (Sandbox Code Playgroud) 我的app.component.ts中有一个注销功能,如下所示:
export class MyApp {
@ViewChild(Nav) nav: Nav;
constructor(){
this.accountMenuItems = [
{ title: 'Login', component: AuthPage, icon: 'log-in' },
{ title: 'My Account', component: MyAccountPage, icon: 'contact' },
{ title: 'Logout', component: AuthPage, icon: 'log-out' },
];
}
logOut() {
this.authenticate.signOut();
//THIS BELOW ISN"T NEEDED WHEN I COMMENT OUT THE TABMENU
this.nav.setRoot(this.accountMenuItems[2].component);
}
}
Run Code Online (Sandbox Code Playgroud)
和auth服务中的signtout方法命名为authenticate:
signOut(): Promise<void> {
return this.afAuth.auth.signOut();
}
Run Code Online (Sandbox Code Playgroud)
但是当我使用标签菜单执行此功能时,它不再退出了我注意到当我取消选项卡菜单时,它在这里工作的是标签菜单:
<ion-nav [root]="rootPage" main #content swipeBackEnabled="false"></ion-nav>
<ion-tabs>
<ion-tab [root]="tab1Root" tabIcon="home"></ion-tab>
<ion-tab [root]="tab2Root" tabIcon="search"></ion-tab>
<ion-tab [root]="tab3Root" tabIcon="map"></ion-tab> …Run Code Online (Sandbox Code Playgroud) 我按照https://ionicframework.com/docs/native/google-plus/中的说明操作.
我使用正确的SHA-1 在https://console.cloud.google.com/apis/credentials/oauthclient中创建了Android客户端(重新检查使用keytool -list -printcert -jarfile <path to your apk>)
登录代码很简单,如说明:
this.googlePlus.login({})
.then(res => console.log(res))
.catch(err => console.error(err));
Run Code Online (Sandbox Code Playgroud)
然而,它从未进入既不then也不是catch.控制台中不显示错误.
离子版3.20.0
Cordova版本7.1.0
Ionic Native GooglePlus 5.3.0
Android手机版5.1.1
cordova-plugin-googleplus 5.3.0
我花了两天时间,Ionic Native Facebook工作正常,而GooglePlus只是默默地失败了.
请指教.
更新1
这似乎是一个问题cordova-plugin-googleplus,就像我正在改变GooglePlus.execute使用时一样
@Override
public boolean execute(String action, CordovaArgs args, CallbackContext callbackContext) throws JSONException {
this.savedCallbackContext = callbackContext;
savedCallbackContext.error(42);
action = "abracadabra";
... //remains unchanged
Run Code Online (Sandbox Code Playgroud)
然后我在Chrome控制台42中看到 - 这意味着,错误处理在cordova-plugin-googleplus插件中无法正常工作.
cordova ionic-framework google-plus-signin ionic-native ionic3
你能告诉我下面两种方法的区别是什么吗?我应该在哪一刻使用它?
book.ts
this.app.getRootNav().push('FromBook', { bookId: this.data.id })
this.navCtrl.push('FromBook', { bookId: this.data.id });
Run Code Online (Sandbox Code Playgroud)
当我们使用下面的内部组件时,它有时会起作用.有时它不是.为什么这种不同的行为有上述2种导航方法?
笔者-page.html中
<div>
<book *ngFor="let book of authorData?.books" [data]="book"></book>
</div>
Run Code Online (Sandbox Code Playgroud) 我正在使用Ionic 3,虽然使用tabUrlPath,但点击标签不会更新Url.下面是代码块:
<ion-tabs tabsPlacement="top" tabsHighlight="true">
<ion-tab tabTitle="Details" [root]="details" tabUrlPath="details"></ion-tab>
<ion-tab tabTitle="Issues" [root]="issues" tabUrlPath="issues"></ion-tab>
</ion-tabs>
Run Code Online (Sandbox Code Playgroud)
任何想法,可能会缺少什么?任何帮助将不胜感激.
我正在使用Ionic 3来构建一个简单的地图应用程序,以便使用OpenStreet地图图块呈现我正在使用传单(类型版本)的地图
我想让用户下载和缓存地图的可能性,因此我在这里找到了传单离线 并希望使用它,因为它允许我使用我的本地存储来存储图像.
现在我的问题出现了,我正在尝试将打字稿与javascript混合,我无法弄清楚如何使其正常工作.
我做了什么,问题是什么:
我安装了传单类型版本,然后安装了传单离线javascript版本.
现在我在页面中将它们导入如下:
import * as leaflet from 'leaflet';
import 'leaflet-offline';
Run Code Online (Sandbox Code Playgroud)
现在,如果我尝试按照示例中的说明使用库,我会得到一个打字稿错误,它指示我离线的属性不在对象TileLayer中.
leaflet.tileLayer.offline('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', tilesDb, {
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
subdomains: 'abc',
minZoom: 13,
maxZoom: 19,
crossOrigin: true
}).addTo(this.map);
Run Code Online (Sandbox Code Playgroud)
为了避免这种情况,我补充道
export namespace tileLayer {
function wms(baseUrl: string, options?: WMSOptions, offline?: any): TileLayer.WMS;
function offline(url?: any, tilesDb?: any, options?: any): any;
}
Run Code Online (Sandbox Code Playgroud)
该函数offline位于tileLayer本身的命名空间中.
当前的问题 在我尝试运行应用程序的那一刻,一切正常,除了实际的地图,我看不到它,当我调查它时得到的错误如下:
错误类型错误:无法在NewClass._TateUrl(vendor.js:163489)的NewClass._addTile(vendor.js:79419)的NewClass._update(供应商,js:73419)的NewClass.getTileUrl(vendor.js:163489)中读取null的属性'then' .js:79310)在NewClass._setView(vendor.js:79171)的NewClass._resetView(vendor.js:79129)NewClass.fire(vendor.js:68787)NewClass._move(vendor.js:72343)at at NewClass._catchTransitionEnd中的NewClass._onZoomTransitionEnd(vendor.js:72800)(vendor.js:72732)
我确定我犯了一些愚蠢的错误,但我在这个问题上失去了很多时间.
任何人都有一些关于如何解决这个问题的线索?
ionic3 ×10
typescript ×6
angular ×5
ionic2 ×4
cordova ×1
firebase ×1
ionic-native ×1
javascript ×1
leaflet ×1
mobile ×1
rxjs ×1
tabs ×1
updates ×1