我正在使用最新版本的IonicFramework,它使用了引擎盖下的angular-ui-router 0.2.8.这是我第一次使用ui-router所以我可能犯了一个愚蠢的错误,但我无法弄清楚它是什么.当我导航到我刚刚添加的新状态/视图集时,出现"超出最大调用堆栈大小"错误,Chrome选项卡崩溃.
我的基本HTML非常简单:
<body ng-app="checkinApp" ng-controller="GlobalCtrl">
<nav-view></nav-view>
</body>
Run Code Online (Sandbox Code Playgroud)
这是相关屏幕的路由配置:
app.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('event', {
url: "/event"
,templateUrl: "templates/event.html"
,controller: "MainCtrl"
})
.state('event.chooseEvent', {
url: "/choose"
,templateUrl: "templates/chooseEvent.html"
,controller: "MainCtrl"
})
.state('event.eventCheckin', {
url: "/checkin"
,templateUrl: "templates/eventCheckin.html"
,controller: "MainCtrl"
});
// if none of the above are matched, go to this one
$urlRouterProvider.otherwise("/event/choose");
});
Run Code Online (Sandbox Code Playgroud)
只需使用上述路由配置启动应用程序就会导致错误,无需其他交互.
以下是我的看法......
event.html:
注意<nav-view></nav-view>块,我期望子视图呈现.
<side-menus>
<!-- page content -->
<pane side-menu-content>
<header class="bar bar-header bar-positive">
<button class="button button-icon icon ion-navicon" ng-click="toggleMenu()"></button>
<h1 …Run Code Online (Sandbox Code Playgroud) Parse.com是否支持使用条件GET etags和if-none-match使用条件GET?我正在使用第三方API,这需要将其作为必须限制,以限制对其服务器的API调用.我使用Cloud Code作为后端,将数据发送到Cordova /离子混合应用程序.谢谢
最近我听说过Accelerated Mobile Pages项目,并阅读了一些有关它的信息.
我想知道如何在现有的基于Ionic和Angular的网站上实现它?
昨天,我提交我的应用程序进行审核,但我收到了苹果的消息.
应用程序在IPv6网络上进行审核.请确保您的应用支持IPv6网络,因为需要IPv6兼容性.
有关支持IPv6网络的其他信息,请参阅支持iPv6 DNS64/NAT64网络.
有关网络概述,请参阅关于网络.
我的应用程序是使用离子框架,我该如何解决这个问题.
我已经使用域来访问我的服务器,但这个问题仍然存在.
我有一个视图,在Ionic + Angular应用程序中打开一个模态的简单按钮.单击按钮后正确显示模态模板:
<ion-modal-view>
<ion-header-bar>
<h1 class="title">Popular tags</h1>
<div class="buttons">
<button class="button button-clear button-stable" ng-click="closePopularForm()">Close</button>
</div>
</ion-header-bar>
<ion-content>
<div class="list">
<div class="item-divider text-center">
Select a tag to follow.
</div>
<label class="item">
<button class="button button-balanced" ng-click="addPopularTag('china')">China</button>
<button class="button button-balanced" ng-click="addPopularTag('uk')">United Kingdom</button>
<button class="button button-balanced" ng-click="addPopularTag('us')">United States</button>
</label>
</div>
</ion-content>
</ion-modal-view>
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,模态包含3个按钮,每个按钮调用相同的功能但具有不同的参数.我有这个控制器包含功能:
app.controller('HomeCtrl', function($scope, $ionicSideMenuDelegate, $ionicModal) {
$ionicModal.fromTemplateUrl('add-popular.html', { scope: $scope }).then(function(modal) {
$scope.modalPopular = modal;
});
$scope.closePopularForm = function() {
$scope.modalPopular.hide();
};
$scope.openPopularForm = function() {
$scope.modalPopular.show();
};
$scope.addPopularTag = function(poptag) …Run Code Online (Sandbox Code Playgroud) 如何禁用离子2中所有页面的转换?
ionic 2 NavController允许您在特定视图上执行此操作
nextPage() {
this.navCtrl.push(HomePage, {}, {animate: false})
}
Run Code Online (Sandbox Code Playgroud)
但是如何全局禁用所有页面的所有转换?
我正在使用PDFMake来创建具有预定义文档定义的pdf.在我的旧离子1项目中,我将编码的字符串传递给print函数,该函数工作正常.这是旧离子1的代码
var dd = $scope.createDocumentDefinition();
$timeout(function () {
var pdf = pdfMake.createPdf(dd);
pdf.getBase64(function (encodedString) {
console.log(encodedString);
$ionicLoading.hide();
window.plugins.PrintPDF.print({
data: encodedString,
type: 'Data',
title: 'Print Document',
success: function () {
console.log('success');
},
error: function (data) {
data = JSON.parse(data);
console.log('failed: ' + data.error);
}
});
});
}, 1000);
Run Code Online (Sandbox Code Playgroud)
现在我正在将我的项目升级到Ionic 3,所以我尝试了相同的东西,但输出不同,这是我的新离子3代码.打印机打开但不是根据我的文档定义打印它只打印编码的字符串.
let printer_ = this.printer;
var dd = this.createDocumentDefinition();
var pdf = pdfMake.createPdf(dd);
pdf.getBase64(function (_encodedString) {
let options: PrintOptions = {
name: 'MyDocument'
};
console.log(JSON.stringify(pdf));
printer_.print(_encodedString, options).then((msg)=>{
console.log("Success",msg);
},(error) => {
console.log("Error", …Run Code Online (Sandbox Code Playgroud) 我目前正在研究项目为Angular 6,Ionic 4 Hybrid的旧代码。所有功能模块正在延迟加载。
问题是,导航到另一页后,我可以在nav工具的“内存”选项卡上看到上一页仍然存在,ngOnDestroy并且尚未真正触发。
为了给您更多细节,我的应用程序路由模块是:
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { routes } from './app.routes';
@NgModule({
imports: [RouterModule.forRoot(routes, { enableTracing: false, useHash: false
})],
exports: [RouterModule],
})
export class AppRoutingModule { }
Run Code Online (Sandbox Code Playgroud)
我的路线是:
export const routes: Routes = [
{
path: '', redirectTo: '/home',
pathMatch: 'full'
},
{
path: 'accounts',
loadChildren:
'../pages/accounts/accounts.page.module#AccountsPageModule',
canActivate: [AuthGuardService]
},
{
path: 'administration',
loadChildren:
'../pages/administration/administration.page.module#AdministrationPageModule'
},
{
path: 'bookings',
loadChildren:
'../pages/bookings/bookings.page.module#BookingsPageModule',
canActivate: [AuthGuardService],
}, …Run Code Online (Sandbox Code Playgroud) ionic-framework ×10
angularjs ×4
cordova ×2
ionic2 ×2
ios ×2
amp-html ×1
angular ×1
etag ×1
ionic-view ×1
ionic3 ×1
javascript ×1
mobile ×1
networking ×1
pdfmake ×1
performance ×1
xcode ×1