使用 ionic 3 我从 wordpress api 获取了一些数据,然后在应用程序 UI 上显示相同的数据。除了内容中包含的 HTML 标签外,一切似乎都正常。html 标签也被打印出来。我参考了一些建议使用以下代码的资源:-
`var app = angular.module('myHDApp', []);
app.filter('removeHTMLTags', function() {
return function(text) {
return text ? String(text).replace(/<[^>]+>/gm, '') : '';
};
});
Run Code Online (Sandbox Code Playgroud)
我已经在我的 .ts 代码中实现了上述功能,但它似乎对我不起作用,因为我仍然在内容中获得 HTML 标签。
我无法运行ionic run android。我检查后cordova requirements,它显示
Android target: Not installed
Android SDK not found.
Run Code Online (Sandbox Code Playgroud)
我应该如何解决问题?我在 D 驱动器中有我的 SDK,我已经正确设置了 ANDROID_HOME 和路径,我想


另外,我做了android列表目标,如下所示。如果需要修复错误,我应该如何安装它?
附上cordova android版
我的应用程序中有一个项目列表。这是代码
<ion-list>
<ion-item-sliding #item *ngFor="let productSize of productSizes">
<ion-item>
... some stuff
</ion-item>
<ion-item-options side="right">
<button ion-button color="danger" (click)="RemoveItem(productSize)">X</button>
</ion-item-options>
</ion-item-sliding>
</ion-list>
Run Code Online (Sandbox Code Playgroud)
当用户向左滑动时,会出现一个删除按钮,让用户可以删除该项目。
我想在没有删除按钮的情况下执行此操作。当他向左滑动并释放鼠标或触摸时,删除该项目。
所以这就是我尝试过的
keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000
Run Code Online (Sandbox Code Playgroud)
但我得到了这个..
keytool error: java.security.NoSuchAlgorithmException: RSA KeyGenerator not available
java.security.NoSuchAlgorithmException: RSA KeyGenerator not available
Run Code Online (Sandbox Code Playgroud)
我该怎么办 ?
ps 使用:jdk1.8.0_121
cordova plugin add http://gitlab.com/<user>/<private-repo>.git
Run Code Online (Sandbox Code Playgroud)
我无法从 GitLab 中的私有存储库添加cordova 插件。当我运行上述命令时,它会引发以下错误:
Error: Failed to fetch plugin http://gitlab.com/<user>/<private-repo>.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! fetch failed http://gitlab.com/<user>/<private-repo>.git
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 401
npm ERR! fetch failed http://gitlab.com/<user>/<private-repo>.git
npm WARN retry will retry, error on last attempt: Error: …Run Code Online (Sandbox Code Playgroud) 我想减小相机 API 拍摄的图像的大小,但质量降低并不好。最好的办法是降低分辨率,但我不想为所有图像使用目标宽度和高度。
例如,我希望图像宽度为 1280 并且图像高度按比例自动更改,但在 API 中我应该使用精确的宽度和高度。
如何通过图像比例更改高度动态???
现在,我使用以下代码:
this.camera.getPicture({
quality: 60,
destinationType: this.camera.DestinationType.FILE_URI,
sourceType: sourceType,
mediaType: this.camera.MediaType.PICTURE,
targetWidth: 1280,
targetHeight: 1280,
encodingType: this.camera.EncodingType.JPEG,
saveToPhotoAlbum: (source === PictureSource.CAMERA),
allowEdit: true
})
Run Code Online (Sandbox Code Playgroud) 我正在尝试在 ionic 3 中的一个选项卡内创建三个选项卡,但是我无法让它工作。
这是我尝试做的一个例子,但它似乎是用早期版本的 ionic 实现的。我正在使用离子 3.10.3
来自 CLI 的 ionic -v 打印 3.10.3
以下是我的项目中的一些信息。
我有一个包含三个选项卡(主页、消息、设置)的主页,我想在消息选项卡内容中创建其他三个选项卡(全部、已读、未读)。
这是我的项目的内容
主要的
/src/pages/main/main.ts
Run Code Online (Sandbox Code Playgroud)
/src/pages/main/main.ts
Run Code Online (Sandbox Code Playgroud)
/src/pages/main/main.html
Run Code Online (Sandbox Code Playgroud)
import { Component } from '@angular/core';
import {NavController, NavParams} from 'ionic-angular';
import { HomePage } from '../home/home';
import { SettingPage } from '../setting/setting';
import { MessagePage } from '../message/message';
@Component({
selector: 'page-main',
templateUrl: 'main.html'
})
export class MainPage {
tabHomeRoot : HomePage;
tabSettingRoot: SettingPage;
tabMessageRoot: MessagePage;
constructor(){
}
}Run Code Online (Sandbox Code Playgroud)
其他标签的内容是基本的,所以我只放消息标签的内容
信息
/src/pages/message/message.ts
Run Code Online (Sandbox Code Playgroud)
/src/pages/main/main.html
Run Code Online (Sandbox Code Playgroud)
/src/pages/message/message.html
Run Code Online (Sandbox Code Playgroud)
<ion-tabs>
<ion-tab [root]="tabHomeRoot" …Run Code Online (Sandbox Code Playgroud)我刚刚使用下一个命令创建了一个新应用程序:
ionic start myapp
Run Code Online (Sandbox Code Playgroud)
一切正常,但是当我尝试部署到 Android 时(我的 Android Studio 环境已正确安装和配置),出现下一个错误:
错误:无法 通过注册表获取插件 cordova-plugin-statusbar@ https://github.com/apache/cordova-plugin-statusbar.git。
我尝试部署:
ionic cordova run android
Run Code Online (Sandbox Code Playgroud)
提前致谢。
我正在尝试在我的应用中实现聊天。
我写了一个 autosizing ion-textarea 如下:查看
<ion-footer [keyboardAttach]="content">
<ion-toolbar class="text-input">
<ion-item no-lines>
<ion-textarea autosize
rows="1"
placeholder="Votre message..."
autocomplete="on"
autocorrect="on"
[(ngModel)]="message"
>
</ion-textarea>
<button ion-button small icon-only round item-end color="secondary" (tap)="onSend()">
<ion-icon name="send"></ion-icon>
</button>
</ion-item>
</ion-toolbar>
</ion-footer>
Run Code Online (Sandbox Code Playgroud)
CSS
ion-footer {
ion-toolbar.toolbar.toolbar-ios {
&.toolbar:last-child {
padding-bottom: 0px;
height: auto;
}
}
ion-item.item-textarea {
background-color: transparent;
}
.text-input {
height: auto;
div.input-wrapper {
background-color: #fff;
border-radius: 20px;
textarea.text-input {
margin-left: 8px;
max-height: 100px;
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
指示
import {ElementRef, HostListener, Directive, OnInit, ViewChild} …Run Code Online (Sandbox Code Playgroud) 我正在使用带有延迟加载页面的 Ionic 3。尝试在页面内的组件中显示模式时,出现以下错误:
No component factory found for CourseEditorComponent. Did you add it to @NgModule.entryComponents?
Run Code Online (Sandbox Code Playgroud)
正如你可以看到下面下来,我已经添加了CourseEditorComponent作为entryComponent到courses.modules.ts,其中得到由进口dashboard.modules.ts。
我对 Angular/Ionic 中使用自定义 entryComponents 的方式有什么误解吗?
等级制度
DashboardPage
-CoursesComponent
--CourseEditorComponent
--CourseCreatorComponent
-InstructorsComponent
Run Code Online (Sandbox Code Playgroud)
模块
仪表板.module.ts
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { DashboardPage } from './dashboard';
import { CoursesModule } from "./courses/courses.module";
@NgModule({
declarations: [
DashboardPage
],
imports: [
IonicPageModule.forChild(DashboardPage),
CoursesModule
],
})
export class DashboardPageModule {}
Run Code Online (Sandbox Code Playgroud)
course.module.ts
import { NgModule } from '@angular/core';
import …Run Code Online (Sandbox Code Playgroud)