标签: ionic2

Ionic2 $ font-family-base无效

$font-family-baseIonic2中的变量不起作用.

app.variable.scss文件中我添加了一个新值,但旧值仍然存在.

其他变量如$font-size-base工作正常

这些是我建造的最大任务www:

gulp.task("fonts", function () {
    return copyFonts({
        src: [
          "app/fonts/**/*.+(eot|ttf|woff|woff2|svg)"
        ]
    });
});

gulp.task("sass", function () {
    return buildSass({
        sassOptions: {
            includePaths: [
              "node_modules/ionic-angular",
              "node_modules/ionicons/dist/scss"
            ]
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

那是我的字体

@font-face {
  font-family: "Maven Pro";
  font-style: normal;
  font-weight: 400;
  src: local("Maven Pro"), local("Maven-Pro-Regular"), url("#{$font-path}/MavenPro-Regular.ttf") format("truetype");
}

@font-face {
  font-family: "Maven Pro";
  font-style: normal;
  font-weight: 500;
  src: local("Maven Pro Medium"), local("Maven-Pro-Medium"), url("#{$font-path}/MavenPro-Medium.ttf") format("truetype");
}

@font-face {
  font-family: "Maven Pro"; …
Run Code Online (Sandbox Code Playgroud)

css sass ionic-framework ionic2 ionic3

0
推荐指数
1
解决办法
1604
查看次数

在离子2 angularjs 2的几个视图之间共享一个函数

关于我的应用程序与离子2和angularjs的几个视图我在每个页面上使用一些离子吐司消息.这些Toast消息对于每个页面都是相同的.

是否可以在可注入服务中定义这些消息,而不是在所有TS文件中创建相同的函数?

typescript ionic2 ionic3 angular

0
推荐指数
1
解决办法
2378
查看次数

语音识别(语音到文本 - STT cordova插件)

我正在寻找语音识别Ionic2与科尔多瓦框架插件.

如果可以实现,你可以轻轻提供一个代码示例(.html和.ts)吗?

我找到了这个,但是对于Ionic1:http://devgirl.org/2016/01/08/speaking-with-cordova/ 我无法调整Ionic2的代码.

我非常感谢你能提供的任何帮助,对不起我的小英语.

speech-to-text voice-recognition cordova ionic2 angular

0
推荐指数
1
解决办法
4831
查看次数

是否可以在Ionic2/Angular2应用程序中使用HTTPS/SSL?

我一直在寻找一个关于如何在Ionic2/Angular2 Cordova移动应用程序中使用SSL/https的示例,但一直未能找到.

有推荐的方法吗?我一直在寻找,{ Http } from '@angular/http'但看不到任何明显的暴露.

任何指针都将非常感激.

javascript cordova ionic2 angular

0
推荐指数
1
解决办法
3228
查看次数

Ionic 2 - TypeScript | 填充一组接口对象

在问这个问题之前,我确实做了我的功课,我相信你们中的一些人会发现它很愚蠢,但我仍然对新闻稿有点新意,而且我完全在努力解决这个问题.

我有一个界面:

export interface Product {
  name?: string;
  image_rul?: string;
  description?: string;
  price?: number;
  quantity?: number;
}
Run Code Online (Sandbox Code Playgroud)

我正在尝试创建一个Product类型的数组,并用随机值填充该数组.

为了进一步解释我自己,我在做什么:

export class HomePage {
  products: Product[];
  constructor(public navCtrl: NavController) {
    for (var i=0; i< 10; i++) {
      var random: number =  Math.floor(Math.random() * 10) + 1;
      this.products[i] = <Product>{
        name: `Test_${i}`,
        image_rul: "https://unsplash.it/200/?random",
        description: "This is a short description",
        price: random,
        quantity: i
      };
    }
    console.log(this.products);
  }
}
Run Code Online (Sandbox Code Playgroud)

当我运行这个时,我收到一个错误:

polyfills.js:3 Error: Uncaught (in promise): Error: Error in ./HomePage class HomePage_Host - …
Run Code Online (Sandbox Code Playgroud)

javascript arrays typescript ionic2

0
推荐指数
1
解决办法
3924
查看次数

找不到名字'cordova'.离子构建ios

我正在使用ionic2 build.我做了ionic plugin add cordova-plugin-file并使用了以下代码.

import {File} from 'ionic-native';
@Injectable()
export class GlobalVars {
  constructor(platform:Platform) {
    platform.ready().then(() => {
       this.appRootFolder = cordova.file.documentsDirectory;
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

然后我做了 ionic build android ,我得到了这个错误

找不到名字'cordova'

经过2个小时的挣扎,我按照命令解决了问题

npm install -g typings
typings install dt~cordova --save --global 
typings install dt~cordova/plugins/filesystem --save  --global
Run Code Online (Sandbox Code Playgroud)

这有助于构建android,但仍然无法用于iOS.当我跑这个ionic build ios我仍然得到

找不到名字'cordova'

ngcordova ionic2

0
推荐指数
1
解决办法
3527
查看次数

像Ionic 2中的Modal一样警觉

我希望在我的警报中有很多功能,所以我在一个模态中实现了所有的东西...现在我想把这个模态切割为一个警告,就像不占用屏幕上的整个空间并显示左侧空间上的bg超出我们的模态.如下图所示

在此输入图像描述

例如:你能告诉我在模态之外实现它,使它看起来像一个警报..在离子2中

请帮助谢谢

css sass css3 ionic-framework ionic2

0
推荐指数
1
解决办法
3283
查看次数

ionic2 AlertController范围问题

我正在使用ionic2/angular2应用程序开发移动应用程序.我们必须调用另一个外部API来显示一个对话框.从另一个控件返回到我的应用程序后,AlertController范围不起作用.

    import {AlertController, Events } from 'ionic-angular';
    export class BalanceInquiryPage {
      constructor(){
        public alertCtrl: AlertController,
        public events: Events,
      }

      public balanceDetials(formdata): void {
          //fetch the device details from sqlite storage
          this.databaseService.getDeviceDetails().then((result) => {
             this.commonServices.getGeoLocation(this.deviceObj);
             setTimeout(() => {
               let geodevice = this.shareService.getDeviceDetails();
               let balanceenq = JSON.stringify({"mobileNumber":"9199403562", "expDate":"","cardDigits":""});         
              if (window.npciLib){
                 window.npciLib.balanceenq(balanceenq, function (data) {                  
                      let dataobj = JSON.parse(data);
                      if(dataobj.resp.result == 'SUCCESS'){
                        //this.events.publish('alert:presented', 'Success', 'Balance Enquiry Success.', MyaccountPage);
                        let alert = this.alertCtrl.create({
                          title: "Success",
                          subTitle: "balance",
                          buttons: [
                            {
                              text: 'Ok', …
Run Code Online (Sandbox Code Playgroud)

ionic2 angular

0
推荐指数
1
解决办法
560
查看次数

找不到名称“ SafeUrl”

我试图从添加了bypassSecurityTrustUrl方法的控制台中删除不安全警告。但是我得到了错误

user.component.ts

import {Component,OnInit} from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { NavParams,Platform,ViewController } from 'ionic-angular';

@Component({
    templateUrl:`<a [href]="sanitize('sms:'+user.mobile_no)" class="anchor-default">Text</a>`,
    styles:[`
        .anchor-black{color: #000; font-size: 2.4rem;}
        .anchor-default {text-decoration: none;}
        .custom-margin{margin-left:10px;}
        .anchor-right{float:right;padding-top:2px;}
        .text-content{text-overflow: ellipsis; vertical-align: middle; padding-top:12px;}
    `]
})

export class User implements OnInit {

    public user;

    public bStandings:boolean = false;

    constructor(
        public navParams:NavParams, 
        public viewCtrl:ViewController,
        public platform:Platform,
        public domSanitizer:DomSanitizer
    ) {}

    sanitize(url:string){
        return this.sanitizeUrl(url);
    }

    private sanitizeUrl(url:string):SafeUrl {
        this.bStandings = true;
        return this.domSanitizer.bypassSecurityTrustUrl(url);
    }

}
Run Code Online (Sandbox Code Playgroud)

相关问题: 类具有或正在使用外部模块中的名称“ SafeUrl”,但无法命名

任何人请帮助我提前谢谢

javascript html5 ionic2 angular

0
推荐指数
1
解决办法
428
查看次数

无法使用离子服务运行多个项目

我正在使用ionic2.以下是所有产生的信息ionic info.我基本上处理两个不同的离子项目,我想同时为它们提供服务.8000这样做时,默认情况下会在端口上加载一个项目ionic serve.我尝试使用更改第二个端口ionic serve --port 8101.但这并没有启动第二个项目.

这是以下错误:

> ionic-hello-world@ ionic:serve /Users/vramos/Workspace/visitorapp
> ionic-app-scripts serve "--port" "8100"

[21:34:57]  ionic-app-scripts 0.0.44 
[21:34:57]  watch started ... 
[21:34:57]  build dev started ... 
[21:34:57]  clean started ... 
[21:34:57]  clean finished in less than 1 ms 
[21:34:57]  copy started ... 
[21:34:57]  transpile started ... 
 events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE 0.0.0.0:53703
    at Object.exports._errnoException (util.js:1007:11)
    at exports._exceptionWithHostPort (util.js:1030:20)
    at Server._listen2 (net.js:1253:14)
    at listen (net.js:1289:10) …
Run Code Online (Sandbox Code Playgroud)

port ionic2 ionic-cli

0
推荐指数
1
解决办法
2402
查看次数