标签: ionic3

ion-label不会在Ionic2中显示整个文本

我在离子项目中使用离子标签,但描述没有显示(而是显示点点.. ..)我希望它显示整个文本..有什么解决方案吗?

<ion-card *ngFor="let product of products">
    <img [src]="product.imageURL" />
    <ion-card-content>
        <ion-card-title primary [innerHTML]="product.title"></ion-card-title>
        <ion-item class="item-text-wrap">
        <ion-item>
            <ion-label primary>Description</ion-label>
            <ion-label [innerHTML]="product.description"></ion-label>
        </ion-item>
    </ion-card-content>
</ion-card>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

typescript ionic-framework ionic2 ionic3 angular

6
推荐指数
1
解决办法
1万
查看次数

带有过滤器的搜索栏和带有Ionic 2的JSON数据

我对Typescript和Ionic 2很新,我试图通过Ionic 2搜索栏过滤json响应.

这是我的代码:

import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import {Http} from '@angular/http';
import 'rxjs/add/operator/map';



@Component({
  templateUrl: 'build/pages/home/home.html'
})
export class HomePage {

  posts: any;
  private searchQuery: string = '';
  private items: string[];
  constructor(private http: Http) {

    this.initializeItems();

    this.http.get('https://domain.co/open.jsonp').map(res => res.json()).subscribe(data => {
        this.posts = data;
        console.log(this.posts);

    });

  }

  initializeItems() {
    this.items = this.posts;
  }

  getItems(ev: any) {
    // Reset items back to all of the items
    this.initializeItems();

    // set val to the value of the searchbar …
Run Code Online (Sandbox Code Playgroud)

typescript ionic-framework ionic2 ionic3 angular

6
推荐指数
1
解决办法
2万
查看次数

Ionic 3 - 使用异步数据更新Observable

对于社交媒体应用,我有一组使用其ID引用的Feed对象AngularFire 2.一旦这些ID中的每一个都从存储实际feed对象的数据库中提取了相关数据,我希望feedCards用这些信息更新Observable对象,这样我就可以在HTML中异步显示一个feed对象集合.这是一个非常混乱的事件链,所以让我总结一下.

循序渐进的方法

  1. displayFeed()在NavController加载页面feed上的组件之前调用Main.
  2. displayFeed()获取twiner项目,该项目本质上是用户配置文件项目,然后将用户配置文件存储在userProfile变量中.
  3. 加载用户配置文件后,将全局feedCardsObservable设置为等于loadFeed(),返回Observable数组.
  4. loadFeed()使用全局对象的id值userProfile来加载存储在用户配置文件中的订阅源引用列表.
  5. 然后订阅此快照,并将局部feed变量设置为等于源引用的结果列表.
  6. loadFeed返回一个Observable对象,其中feed引用列表由每个feed引用包含的数据映射.
  7. pullFeedData(number) 接受对feed对象的引用并返回带有关联的feed数据的observable.

什么有用

  • alert(JSON.stringify(feedData));提醒正确的feed对象

  • 其他一切.

什么行不通

  • feed.map(...不会更新feed数组,因为pullFeedData(number)pulls并feedData异步返回.因此,alert(JSON.stringify(data));在displayFeed()警报中[null].

码

feed.ts

   userProfile:any;
   feed: FirebaseListObservable<any>;
   feedData: FirebaseObjectObservable<any>;

   feedCards: Observable<any[]>;

   constructor(public db: AngularFireDatabase, public nativeStorage: NativeStorage) {}

   displayFeed():void {
        this.nativeStorage.getItem('twiner').then((res) => …
Run Code Online (Sandbox Code Playgroud)

javascript asynchronous firebase ionic2 ionic3

6
推荐指数
1
解决办法
3217
查看次数

如何在ionic2中管理web2应用程序中的多个滑块?

幻灯片我有这样的HTML

<ion-slides   [pager]="false" slidesPerView="6" #slider_a>
        <ion-slide  *ngFor="let slide of  items_a " #ddd>
            <ion-card class="list-card" >
                <div class="cardInnerWrap">
                    <ion-item>
                      {{slide.gameTitle}}
                    </ion-item>
                     <img src="{{slide.gameImage}}">

                </div>
            </ion-card>
        </ion-slide>
</ion-slides>

<ion-slides   [pager]="false" slidesPerView="6" #slider_b>
        <ion-slide  *ngFor="let slide of  items_b " #ddd>
            <ion-card class="list-card" >
                <div class="cardInnerWrap">
                    <ion-item>
                      {{slide.gameTitle}}
                    </ion-item>
                     <img src="{{slide.gameImage}}">

                </div>
            </ion-card>
        </ion-slide>
</ion-slides>
Run Code Online (Sandbox Code Playgroud)

它在移动设备上工作.问题是当我在Firefox中拖动幻灯片2时(也在Chrome中),幻灯片1也被拖动了.不能单独拖动幻灯片2.如何在离子2中制作2个完全独立的滑块,可在浏览器中使用

javascript typescript ionic2 ionic3 angular

6
推荐指数
1
解决办法
2444
查看次数

如何在IOS cordova项目上自动设置签名团队?

我正在尝试使用fastlane在Jenkins中自动构建/部署我的hybdrid移动应用程序.我使用ionic(v3.3.0)和cordova(v7.0.1)作为来源.我使用fastlane v2.36.0,Xcode是版本8.3.2.

我在jenkins工作中运行的命令

yarn
ionic cordova prepare
fastlane ios build
Run Code Online (Sandbox Code Playgroud)

fastlane/FastFile

platform :ios do
  before_all do
  end

  ios_project_path = "platforms/ios/awesomeproject.xcodeproj"

  desc "Build for IOS"
  lane :build do
    increment_build_number(
      xcodeproj: ios_project_path,
      build_number: ENV["BUILD_NUMBER"]
    )

    # Recreate schemes to ensure a smooth transition from cordova to gym
    recreate_schemes(project: ios_project_path)

    update_project_team(
      path: ios_project_path,
      teamid: "TEAMID"
    )

    #update_provisioning_profile_specifier(xcodeproj: ios_project_path)


      gym(scheme: "awesomeproject",
          configuration: "Debug",
          clean: true,
          project: ios_project_path,
          output_directory: "target")
  end
end
Run Code Online (Sandbox Code Playgroud)

fastlane/Appfile

package_name "com.xxx.awesomeapp"

app_identifier "com.xxx.awesomeapp" # The bundle identifier of your app
apple_id …
Run Code Online (Sandbox Code Playgroud)

xcode ios cordova fastlane ionic3

6
推荐指数
1
解决办法
4394
查看次数

如何使用按钮样式在Ionic 2+中创建自定义文件输入?

这是我的模板:

<label>{{label}}</label>
<input type="file" (change)="fileUpload($event)" id="file-input" style="position:absolute; top: -999999px" #fileInp>
<button ion-button (click)="onClick()">Upload</button>
Run Code Online (Sandbox Code Playgroud)

和ts文件:

@ViewChild('fileInp') fileInput: ElementRef;
@Input() label: string;
@Output() data = new EventEmitter<FormData>();

fileUpload(event) {
  let fd = new FormData();
  fd.append('file', event.srcElement.files[0]);
  this.data.emit(fd);
}

onClick() {
  this.fileInput.nativeElement.click();
}
Run Code Online (Sandbox Code Playgroud)

在Android和浏览器中一切正常,但在iOS上则不行.如果我禁用模板中的按钮,相同的代码将起作用.

cordova ionic2 ionic3 angular

6
推荐指数
2
解决办法
7449
查看次数

如何在一个请求中上传多个文件?

我要将多个图像上传到服务器.

这是DataURL的数组.

items: {
    img_url : string
}[] = [];
Run Code Online (Sandbox Code Playgroud)

我发现离子原生文件传输只能上传一个文件.

我如何上传多个文件?

javascript node.js typescript ionic3 angular

6
推荐指数
1
解决办法
2182
查看次数

角度4 - 在'.ts'文件中的文本的离子3翻译

嘿家伙我想知道如何在'.ts'文件中翻译文本
基本上它是一个加载文本

showLoader() { 
this.loading = this.loadingCtrl.create({
  content: 'Loading...'
});
this.loading.present();

  }
Run Code Online (Sandbox Code Playgroud)

我需要的是将文本"Loading ..."翻译为"Chargement ..."当语言设置为法语
感谢时

typescript ionic2 ionic3 angular

6
推荐指数
1
解决办法
1578
查看次数

离子3:用手机的后退按钮关闭模态

我尝试在我的Ionic App中覆盖手机的后退按钮.

如果我不在页面中,此代码允许我打开模式以关闭应用程序,否则关闭页面.

但这不允许我关闭一个打开的模态.如何检测我是否处于模态中以关闭它?

platform.registerBackButtonAction(() => {

      let nav = app.getActiveNav();
      let activeView: ViewController = nav.getActive();
      console.log(activeView);

      if(activeView != null){
        if(nav.canGoBack()) {
          activeView.dismiss();
        } else{
          let alert = this.alertCtrl.create({
            title: this.pdataManager.translate.get("close-app"),
            message: this.pdataManager.translate.get("sure-want-leave"),
            buttons: [
              {
                text: this.pdataManager.translate.get("no"),
                handler: () => {
                  this.presentedAlert = false;
                },
                role: 'cancel',
              },
              {
                text: this.pdataManager.translate.get("yes"),
                handler: () => {
                  this.presentedAlert = false;
                  this.platform.exitApp();
                }
              }
            ]
          });
          if(!this.presentedAlert) {
            alert.present();
            this.presentedAlert = true;
          }
        }
      }
    });
  }
Run Code Online (Sandbox Code Playgroud)

javascript android cordova ionic3

6
推荐指数
2
解决办法
6540
查看次数

Ionic 3的PWA和Firebase云消息注册

我在这里关注这篇文章(遗憾的是不完整),试图学习如何结识基于Ionic 3的PWA和Firebase云消息传递:使用FCM推送通知

我做了什么:

  1. 正如文章中所建议的那样,将FCM库添加到service-worker.js中:

'use strict';
importScripts('./build/sw-toolbox.js');
importScripts('https://www.gstatic.com/firebasejs/4.9.0/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/4.9.0/firebase-messaging');

firebase.initializeApp({
  // get this from Firebase console, Cloud messaging section
  'messagingSenderId': '47286327412'
});

const messaging = firebase.messaging();

messaging.setBackgroundMessageHandler((payload) => {
  console.log('Received background message ', payload);
  // here you can override some options describing what's in the message; 
  // however, the actual content will come from the service sending messages
  const notificationOptions = {
    icon: '/assets/img/appicon.png'
  };
  return self.registration.showNotification(notificationTitle, notificationOptions);
});

self.toolbox.options.cache = {
  name: 'ionic-cache'
};

// pre-cache our key …
Run Code Online (Sandbox Code Playgroud)

progressive-web-apps firebase-cloud-messaging ionic3

6
推荐指数
1
解决办法
3903
查看次数