Cordova v5.3.1/Ionic v1.1.0(库v1.6.4)
从8.4升级我们的应用程序到iOS 9.该应用程序在iPad/iPad mini上构建并运行良好.但是,它在部署到iPhone时会崩溃.
以下是调试输出:
2015-09-23 11:17:09.920 AnApplicaiton [6490:1359695]***断言失败 - [UIApplication _cachedSystemAnimationFenceCreatingIfNecessary:],/ BuildRoot/Library/People/com.apple.xbs/Sources/UIKit_Sim/UIKit-3505.16/UIApplication.m:1697
2015-09-23 11:17:09.926 AnApplication [6490:1359695]***由于未捕获的异常'NSInternalInconsistencyException'终止应用程序,原因:'访问_cachedSystemAnimationFence需要主线程'
到目前为止,调试控制台是完全相同的.
我希望在用户登录时更改侧边菜单的内容.
示例1 - 未登录的用户:
当用户未登录时显示此侧面菜单.
示例2 - 用户已登录:
如您所见,还有一些额外的菜单项.这些仅在用户登录时显示.
在我的控制器中:
$http.get('http://127.0.0.1:8080/elodieService/consommateurs/'+$localStorage.idconsommateur, { params: { "idconsommateur":$localStorage.idconsommateur, fields: "nom,prenom",format:"json"} }).then(function(result) {
console.log(JSON.stringify(result.data));
$scope.prenomconsommateurConnect=result.data.prenom;
Run Code Online (Sandbox Code Playgroud)
在视图中:
<ion-header-bar class="bar-stable" >
<h1 class="title" ng-hide="!prenomconsommateurConnect" ng-controller="accueilController">Bonjour Hello {{prenomconsommateurConnect}}</h1>
<h1 class="title" ng-hide="prenomconsommateurConnect" ng-controller="accueilController">Bonjour Hello link</h1>
</ion-header-bar>
Run Code Online (Sandbox Code Playgroud)
但我发现总是这个结果"bonjour hello link"我该怎么办?
我能做什么?我应该使用ng-if,ng-show还是ng-hide?或者是否有其他/更好的解决方案?
任何帮助表示赞赏.
我的ion-content应用程序中有一个长的,可滚动的区域,使用一个项目填充项目collection-repeat.
我需要知道哪些项目对用户可见.
我不能用它$ionicScrollDelegate.getScrollPosition来计算答案,因为每个项目都有不同的高度(项目高度是按项目计算的).
我正在尝试在离子卡中插入 inamges。我更喜欢使用卡片,因为我想保持方面的一致性。问题是,正如您在下一张图片中看到的,在一张图片之后的卡片底部有一个空白区域(这里更明显,但也出现在顶部和侧面):
我试过使用 CSS 但没有运气。部分原因可能是我不知道涉及哪个 CSS。另外,我真的不知道如何删除这样的空白。我什至尝试使用负填充值,但它不起作用,所以我认为它不是真正的卡片组件,而是正在解决问题的子部分。
这是我当前的代码:
<div class="card" ng-controller="cycleImagesCtrl">
<div class="item item-body" style="padding: 0px 0px 0px 0px;">
<img src={{imgTitle}} width="100%" />
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
任何提示?
我正在使用简单的 HTML、CSS 和 Angular 开始一个新的 Web 应用程序项目。我们正在使用现有的 Web 服务从某些服务器检索数据,我们尝试使用的一项服务是公共服务:全球天气 SOAP 服务
有没有一种“简单”的方法可以用 Angular 提出请求?实际上我们的“测试”代码是这样的(使用 JQuery,仍然不起作用),但是使用 HTTP 或 RxJS 实现 Angular 方法会更好......
import { Injectable } from '@angular/core';
import * as $ from 'jquery';
@Injectable()
export class SoapServiceProvider {
constructor() { }
testingSoapRequest() {
$.ajax({
url: 'http://www.webservicex.net/globalweather.asmx?op=GetCitiesByCountry',
data: { CountryName: 'Spain' },
success: (data) => {
console.log('Hey, we got a success response', data);
},
error: (err) => {
console.error('We got an error :(', err);
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
我从来没有使用过 JQuery …
我尝试了很多方法来去除离子卡中的边框,但都没有成功。请帮我。这是我的 css 文件:
page-home {
ion-card, .card-ios, .card-md {
border: 0 !important;
box-shadow: 0 !important;
border: none !important;
border-style: none !important;
position: relative;
text-align: center;
// border-top: 3px solid colorofyourchosing
}
.card{
border: 0 !important;
box-shadow: 0 !important;
border: none !important;
border-style: none !important;
} }
Run Code Online (Sandbox Code Playgroud)
这是我在 home.html 中的 html 代码
<ion-card>
<img (click)="goEnvi()" src="assets/imgs/envi.svg"/>
<h6>{{"Enviroment" | translate}}</h6>
</ion-card>
Run Code Online (Sandbox Code Playgroud)
谢谢
我正在使用 Ionic 4 应用程序并安装了该ngx-translate插件。它工作正常,app.component.html但tabs.page.html显示错误。
找不到管道“翻译”
这是我的app.component.html:
<ion-list class="mylist22" color="myheader">
<ion-item color="myheader">
<ion-label>Gender</ion-label>
<ion-select [(ngModel)]="languageSelected" (ionChange)='setLanguage()'>
<ion-select-option value="en" selected>English</ion-select-option>
<ion-select-option value="ar">Arabic</ion-select-option>
</ion-select>
</ion-item>
</ion-list>
Run Code Online (Sandbox Code Playgroud)
在这个视图中,我有语言选择框。
这是我的app.component.ts:
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent {
languageSelected: any = 'en';
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar,
private translate: TranslateService
) {
this.translate.addLangs(['en', 'ar']);
this.translate.setDefaultLang('en');
this.initializeApp();
}
initializeApp() {
this.platform.ready().then(() => { …Run Code Online (Sandbox Code Playgroud) 当我提供 ionic 应用程序时,它可以在浏览器中运行,但用于 android 的构建 apk 不起作用。apk 无法安装。
我试过 ionic cordova build android --release
带有以下消息的构建通过
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\ruban\AppData\Local\Android\Sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
> Task :app:preBuild UP-TO-DATE
> Task :CordovaLib:preBuild UP-TO-DATE
> Task :CordovaLib:preReleaseBuild UP-TO-DATE
> Task :CordovaLib:checkReleaseManifest UP-TO-DATE
> Task :CordovaLib:processReleaseManifest UP-TO-DATE
> Task :app:preReleaseBuild UP-TO-DATE`
Run Code Online (Sandbox Code Playgroud)
D:\myApp\platforms\android\app\src\main\res\drawable-land-hdpi\screen.png: Error: The drawable "screen" in drawable-land-hdpi has no declaration in the base drawable folder or in a drawable-densitydpi folder; this can lead …Run Code Online (Sandbox Code Playgroud) 我的应用程序在浏览器中运行良好,并在启动 android 构建时使用 Cordova Geolocation 作为插件出现此错误
An unhandled exception occurred: [BABEL] /Users/suatkarabacak/Desktop/quarantine/www/2-es2015.js: Could not find plugin "proposal-numeric-separator". Ensure there is an entry in ./available-plugins.js for it. (While processing: "/Users/suatkarabacak/Desktop/quarantine/node_modules/@babel/preset-env/lib/index.js")
See "/private/var/folders/2n/czcjwx7554j_h2hpsj53h81m0000gn/T/ng-ZxzGC4/angular-errors.log" for further details.
[ERROR] An error occurred while running subprocess ng.
Run Code Online (Sandbox Code Playgroud)
来自 package-lock.json
"@babel/preset-env": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.8.3.tgz",
"integrity": "sha512-Rs4RPL2KjSLSE2mWAx5/iCH+GC1ikKdxPrhnRS6PfFVaiZeom22VFKN4X8ZthyN61kAaR05tfXTbCvatl9WIQg==",
"dev": true,
"requires": {
"@babel/compat-data": "^7.8.0",
"@babel/helper-compilation-targets": "^7.8.3",
"@babel/helper-module-imports": "^7.8.3",
"@babel/helper-plugin-utils": "^7.8.3",
"@babel/plugin-proposal-async-generator-functions": "^7.8.3",
"@babel/plugin-proposal-dynamic-import": "^7.8.3",
"@babel/plugin-proposal-json-strings": "^7.8.3",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
"@babel/plugin-proposal-object-rest-spread": "^7.8.3",
"@babel/plugin-proposal-optional-catch-binding": "^7.8.3",
"@babel/plugin-proposal-optional-chaining": "^7.8.3",
"@babel/plugin-proposal-unicode-property-regex": "^7.8.3", …Run Code Online (Sandbox Code Playgroud) 我一直在研究 Ionic 5 中的登录和注册页面。我想在输入文本字段下方显示错误消息,如下所示
所以我实现了 Angular Responsive Forms
ngOnInit() {
this.afAuth.authState.subscribe(data => console.log(data));
this.myForm = this.fb.group({
email: ['', [
Validators.required,
Validators.email
]],
password: ['', [
Validators.required,
Validators.pattern('^(([a-zA-Z][^:.*/}{;])*\d*)$')
]]
});
}
get email(){
return this.myForm.get('email');
}
get password(){
return this.myForm.get('password');
}
Run Code Online (Sandbox Code Playgroud)
这样做之后,我创建了一个带有两个离子输入字段的表单。
<ion-item class="input_item">
<ion-label position="floating">E-Mail</ion-label>
<ion-input formControlName="email" position="floating"></ion-input>
</ion-item>
<div class="validation-errors">
<div class="error-message" *ngIf="email.errors && email.dirty || email.touched">
Your E-Mail is invalid!
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我尝试使用此类“验证错误”,但它没有按照我想要的方式显示消息。我设法让它看起来像这样

但是是否有一些更简单的方法可以像 Angular Material 那样显示错误消息?我可以使用 Ionic 的某些东西,还是必须实现 Angular Material UI 组件?
谢谢回答。
更新:自从我的原始帖子以来,这个问题已经获得了一些关注,并且似乎没有更简单的解决方案,我想为经过的任何人发布使用过的样式:
.validation-errors { …Run Code Online (Sandbox Code Playgroud) validation user-interface ionic-framework angular-material angular
ionic-framework ×10
angular ×4
cordova ×3
angularjs ×2
ionic2 ×2
android ×1
babeljs ×1
css ×1
ionic-view ×1
ionic3 ×1
ionic4 ×1
ios ×1
ios9 ×1
iphone-6 ×1
javascript ×1
soap ×1
validation ×1
wsdl ×1