我有一个用Angular构建的Ionic应用程序.
我使用的是Calendar插件:https: //github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin
我想通过插件创建事件并将它们保存到本地设备的日历中.
我已经添加了插件:
cordova plugin add https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin.git
Run Code Online (Sandbox Code Playgroud)
我尝试在我的控制器中使用它:
ionic.Platform.ready(function(){onError);
window.plugins.calendar.createEvent(title, location, notes, start, end, onSuccess, onError);
});
Run Code Online (Sandbox Code Playgroud)
在浏览器中它说window.plugins是未定义的,在设备上错误是'undefined'不是一个对象(评估'window.plugins.calendar')
我为此搜索过高低,我似乎找不到有效的解决方案.
知道如何使用Ionic的Cordova插件吗?
javascript angularjs cordova ionic-framework cordova-plugins
请问有人可以澄清我什么时候会ion-nav-view反对ion-view?我正在学习AngularJS/Ionic(我对AngularJS有基本的了解;并希望使用Ionic来增强它).
我理解ion-nav-viewAngularUI路由器服务(?)的实现,这是必须的,以便在视图中具有嵌套视图.但是文档没有说明我应该在哪里使用其中一个?
所有文档的状态ion-view是:内容容器,用于告诉父ionNavBar当前视图.
但我已经看到了一个ion-view使用过的外部导航栏界面.
什么给出了什么?
我想展示内容.我在自定义模板文件上手动添加了自定义代码.
<ion-content>
<ion-tabs class="tabs-positive tabs-icon-only">
<ion-tab title="Home" icon-on="ion-ios-filing" icon-off="ion-ios-filing-outline">
My Content here
</ion-tab>
<ion-tab title="About" icon-on="ion-ios-clock" icon-off="ion-ios-clock-outline">
My Content here 1
</ion-tab>
<ion-tab title="Settings" icon-on="ion-ios-gear" icon-off="ion-ios-gear-outline">
My Content here 3
</ion-tab>
</ion-tabs>
</ion-content>
</ion-view>
Run Code Online (Sandbox Code Playgroud)
我从这里拿了示例代码
http://ionicframework.com/docs/api/directive/ionTabs/
我能够看到标签,但不能看到内容.是的,如果我按照离子的示例应用程序选项卡我能够做到这一点.但我需要一个以上.
我们可以在这里展示内容.
我有一个简单的Cordova包装应用程序,它指向外部网页,而不定义任何自己的视图.
我希望来自该域的所有内部链接都加载到应用程序内,但所有外部链接(http://twitter.com等)都要加载到系统浏览器中,因此这些页面具有后退/前进功能.
在具有视图的普通应用程序中,我可以设置target='_system'在默认浏览器中加载链接,或使用cordova-plugin-inappbrowser在Web浏览器视图中显式打开链接.不幸的是,在这种情况下,我无法编辑服务器端代码,因此需要一个适用于应用程序的解决方案.
如果我这样定义config.xml,那么内部和外部链接都会加载到app中.
<content src="http://example.com/" />
<access origin="*" />
<allow-navigation href="*" />
Run Code Online (Sandbox Code Playgroud)
如果我定义了config.xmlwith allow-intent,则在系统浏览器中打开内部和外部链接.
<content src="http://example.com/" />
<access origin="*" />
<allow-navigation href="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
Run Code Online (Sandbox Code Playgroud)
其他人建议使用自定义javascript来覆盖targetto _system,但是因为我没有自己的观点,所以我不能真正做到这一点.
是否可以定义allow-intent为科尔多瓦-插件白名单以这样的方式,包括不属于内部域的所有URL?
或将我需要以某种方式覆盖shouldStartLoadWithRequest在MainViewController,然后调用[[UIApplication sharedApplication] openURL:url]?
我是这些技术的新手,请原谅我,如果我的一些问题没有意义!
我必须为我的公司开发Web应用程序和移动应用程序.我正在考虑Ionic 2,因为它使用Angular 2,我想在我使用angular 2构建的web-app和使用Ionic 2的移动应用程序之间共享代码,因为它们几乎可以做同样的事情.
我该怎么办?我想保持应用程序的逻辑相同,我只想修改一些关于UI的东西.谢谢!
我的应用程序使用Ionic 1.3.2构建的一个奇怪的问题只在iOS上发生.
当我点击textarea输入时,键盘像往常一样打开,这部分按预期工作,input元素获得焦点.
但是,当我在任何输入之外点击屏幕的某些区域时,比如我所拥有的文本字段下方20px,键盘要么操作要么关闭,如果它已经打开但是input没有得到焦点,则立即重新打开document.activeElement实际上返回body元素(在Safari检查器中检查).
因此,在这种模式下,我可以输入我想要的任何内容,但输入的文本不会出现在任何地方,好像我在无处打字(这有点奇怪).
此外,如果我在其中一个地方点击2-3次,整个应用程序会在EXC_BAD_ACCESS内部一些UIWebView内部崩溃:
* thread #1: tid = 0x35ea78, 0x000000010c2c3acb libobjc.A.dylib`objc_msgSend + 11, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
* frame #0: 0x000000010c2c3acb libobjc.A.dylib`objc_msgSend + 11
frame #1: 0x000000010ec56024 UIKit`-[UITextInteractionAssistant(UITextInteractionAssistant_Internal) swallowsDoubleTapWithScale:atPoint:] + 264
frame #2: 0x000000010ea4ce75 UIKit`-[UIWebDocumentView shouldSelectionAssistantReceiveDoubleTapAtPoint:forScale:] + 91
frame #3: 0x000000010f1b930a UIKit`_UIWebDoubleTapAtLocation + 369
frame #4: 0x000000010ec3d409 UIKit`-[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 57
frame #5: 0x000000010ec451a8 UIKit`_UIGestureRecognizerSendTargetActions + 109
frame #6: 0x000000010ec42c77 UIKit`_UIGestureRecognizerSendActions + 227 …Run Code Online (Sandbox Code Playgroud) 美好的一天,
我正在研究Ionic应用程序,我正在从JSON提要中动态加载图像.我希望当从外部URL拉入图像时,占位符图像显示在其位置,此后,占位符图像应该在加载后由"真实"图像替换.
我目前的情况的一个例子是:
<ion-card *ngFor="let item of items"...
<img [src]="item.picture" />
Run Code Online (Sandbox Code Playgroud)
感谢和问候.
我的android模拟器有问题.当我关闭并重新打开我的应用时,该位置不会自动发送.我必须进入扩展控件 - >位置,然后单击Ionic Geolocation getCurrentPosition函数的"发送"按钮来接收它.
当我启动Android模拟器并且第一次打开应用程序时,这不是必需的.知道如何自动发送位置无论如何?
android geolocation android-emulator google-geolocation ionic-framework
我想触发/打开来自Ionic 4中另一页的文件输入.
在第1页中,我有一个按钮可以转到模态,在页面模态中我想自动触发<input file>对话框
零件
ionViewWillEnter() {
document.getElementById('file').click(); // Tried with this one 1st, this only works in Internet Explorer / Edge
this.fileInput.nativeElement.click(); // And also this with @ViewChild
}
Run Code Online (Sandbox Code Playgroud)
HTML
<input type="file" name="file" #file id="file" (change)="fileChange($event)" required>
Run Code Online (Sandbox Code Playgroud) 在Ionic 3中,您可以使用navController的第二个参数将数据传递到下一页并使用navParams服务检索它.
这是一个非常方便的功能.在Ionic 4中是否有等效的路由api?
你总是可以JSON.stringify对象/数组到routerParams,这在我看来不太方便.
在Ionic 4中,您可以使用ComponentProps和@Input()通过modalController传递数据,使其更适合快速推送/弹出实现.
编辑
我对这个问题的意图是找出是否有来自Angular 6+或Ionic 4+的原生API.我很清楚如何实现自定义服务或解析器来实现此目的.
目标是充分利用离子和角度的api,因为在较大的项目中,每个自定义代码都需要文档并增加复杂性.
ionic-framework ×10
angular ×4
cordova ×3
javascript ×3
android ×2
angularjs ×2
ionic2 ×2
ios ×2
geolocation ×1
html ×1
ionic ×1
ionic3 ×1
ionic4 ×1
mobile ×1
safari ×1
typescript ×1
uiwebview ×1