我刚开始学习 ionic 框架并尝试使用 firebase 实现 Facebook 登录。我在浏览器中运行这个应用程序,我有以下代码给我“cordova_not_available”错误。任何人都可以帮助我了解我的尝试有什么问题。
谢谢你。
在 app.module.js 里面
import {Facebook} from '@ionic-native/facebook';
import firebase from 'firebase';
export const firebaseConfig = {
....
....
};
firebase.initializeApp(firebaseConfig);
Run Code Online (Sandbox Code Playgroud)
在 home.ts 里面
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import {Facebook} from '@ionic-native/facebook';
import firebase from 'firebase';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController, public facebook: Facebook) {
}
fblogin() {
var me = this;
me.facebook.login(['email']).then(res=>{
const fc = firebase.auth.FacebookAuthProvider.credential(res.authResponse.accessToken); …Run Code Online (Sandbox Code Playgroud) 你好吗?。我正在学习带有 Ionic 3 教程的 Google 地图。我已经完成了那里解释的所有内容,但是当项目启动时,出现了这个错误。我已经调查了很多,但没有任何效果。谢谢!。
Error: Uncaught (in promise): ReferenceError: google is not defined
ReferenceError: google is not defined
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
家.ts
import { Component, ViewChild, ElementRef } from '@angular/core';
import { NavController } from 'ionic-angular';
import { IonicPage } from 'ionic-angular';
declare var google;
@IonicPage()
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@ViewChild('map') mapElement:ElementRef;
map: any;
start = 'chicago, il';
end = 'chicago, il';
directionsService = new google.maps.DirectionsService;
directionsDisplay = new google.maps.DirectionsRenderer;
constructor(public navCtrl: NavController) { …Run Code Online (Sandbox Code Playgroud) 我知道 Stackoverflow、离子论坛和其他地方提供的解决方案。但是当我在 Android 和 IOS 上测试时,这些都不适合我。
https://ionicframework.com/docs/native/call-number/
让我向您展示我遵循的确切步骤:
1) ionic cordova 插件添加电话号码
2) npm install --save @ionic-native/call-number
3)import在 app.module.ts 中添加import { CallNumber } from '@ionic-native/call-number';
4) 添加提供者 CallNumber
5)最后,
import { CallNumber } from '@ionic-native/call-number';
constructor(private callNumber: CallNumber) { }
...
this.callNumber.callNumber("18001010101", true)
.then(() => console.log('Launched dialer!'))
.catch(() => console.log('Error launching dialer'));
Run Code Online (Sandbox Code Playgroud)
我什至尝试使用 async 和 promise :
async telephoneCall(): Promise<any>{
try{
await this.callNumber.callNumber(String('18001010101'), true);
}catch(e){
console.log("User Error: "+ e);
}
}
Run Code Online (Sandbox Code Playgroud)
上述解决方案都不会在编译时或运行时引发错误。我不确定出了什么问题。我正在使用 Ionic 3 和 Angular …
我正在尝试在我的 ionic 3 项目中安装 font-awesome。我使用了命令:
npm install font-awesome --save
Run Code Online (Sandbox Code Playgroud)
这是 package.json 文件的内容
{
"name": "ionic-hello-world",
"version": "0.0.0",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"config": {
"ionic_copy": "./config/copy.config.js"
},
"dependencies": {
"@angular/common": "4.1.3",
"@angular/compiler": "4.1.3",
"@angular/compiler-cli": "4.1.3",
"@angular/core": "4.1.3",
"@angular/forms": "4.1.3",
"@angular/http": "4.1.3",
"@angular/platform-browser": "4.1.3",
"@angular/platform-browser-dynamic": "4.1.3",
"@ionic-native/camera": "^3.13.1",
"@ionic-native/core": "3.10.2",
"@ionic-native/network": "^4.2.1",
"@ionic-native/splash-screen": "3.10.2",
"@ionic-native/status-bar": "3.10.2",
"@ionic/storage": "2.0.1",
"angularfire2": "^4.0.0-rc0",
"firebase": …Run Code Online (Sandbox Code Playgroud) 我正在尝试通过ng-inline-svg包在 ionic 3.3.0/Angular 4.1.2 中使用内联 SVG 。
import { HttpModule } from '@angular/http';
import { InlineSVGModule } from 'ng-inline-svg';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, HttpModule, InlineSVGModule],
bootstrap: [AppComponent]
})
class AppModule {}
Run Code Online (Sandbox Code Playgroud)
模板
<div class="icon icon-shop" aria-label="My icon" [inlineSVG]="'../../assets/symbol-defs.svg#icon-shop'"></div>
Run Code Online (Sandbox Code Playgroud)
我得到了错误
无法绑定到“inlineSVG”,因为它不是“div”的已知属性。
我不知道如何使用查询字符串调用邮政服务。当我们使用post方法在 url 下运行时:https://test.data.com/myAPI/Login/authenticateUser?username=temp&password=Temp@123®id=''&versions=1&deviceType=1在邮递员中它工作得很好,但不要如何在ionic 3代码中传递查询字符串
在下面的代码中,当我们将查询字符串作为参数传递时,它给出了一个错误的请求错误。
return this.http.post("https://test.data.com/myAPI/Login/authenticateUser", params).subscribe((data: any) => {
// let resp = data;
// this.items = JSON.parse(JSON.parse(resp).Data);
console.log('my data: ', data);
}, err => {
console.log(err);
});
Run Code Online (Sandbox Code Playgroud)
我需要在我的 Ionic 3 应用程序中使用发布订阅方法。
我关注了这个页面。
有什么方法可以将 MQTT 与我们的 Ionic 3 应用程序联系起来?如果是,怎么会?我究竟需要怎么做才能成功连接?
我ng2-mqtt使用安装服务
npm install ng2-mqtt --save
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
index.html
<script src="cordova.js"></script>
<script src="node_modules/ng2-mqtt/mqttws31.js" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)
home.ts
import {Paho} from 'mqttws31'
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
private _client: Paho.MQTT.Client;
constructor(public paho: Paho) {
}
this._client = new Paho.MQTT.Client("52.66.30.178", 1883, "path", "someclient_id");
this._client.onConnectionLost = (responseObject: Object) => {
console.log('Connection lost.');
this.getServerMessage();
this._client.onMessageArrived = (message: Paho.MQTT.Message) => {
console.log('Message arrived.');
};
this._client.connect({ onSuccess: this.onConnected.bind(this); });
} …Run Code Online (Sandbox Code Playgroud) 我正在关注https://ionicframework.com/docs/native/fcm/ 将 Firebase 集成到我的 Ionic 项目中。它显示运行时错误,未找到 Firebase 提供程序。
运行时错误:
我有一个动态创建的表单页面,如下所示:

空格是输入,整行是一个按钮。有没有办法点击按钮,即整行,然后选择/关注相应的输入?请记住,输入的数量由用户决定,页面上最多可以有 300 行这样的行。
export class HomePage {
public homeForm: FormGroup;
constructor(
public navCtrl: NavController,
public userData: UserDataProvider,
private formBuilder: FormBuilder,
public renderer: Renderer,
public elementRef: ElementRef
) {
this.homeForm = new FormGroup({
bicos: new FormArray([
new FormControl(null)
])
});
addInputs() {
(<FormArray>this.homeForm.controls['bicos'])
.push(new FormControl(null));
}
}
Run Code Online (Sandbox Code Playgroud)
<form [formGroup]="homeForm">
<ion-row formArrayName="bicos" *ngFor="let item of homeForm.controls.bicos.controls; let i = index" >
<button id={{i}} ion-button clear style="color: black" class='hidden-button' (click) = "doSomething()">
<ion-col align-self-center col-2>{{i+1}}</ion-col>
<ion-col text-center align-self-center …Run Code Online (Sandbox Code Playgroud) 正如标题中所说,我的问题是当我这样做时:
this.storage.get('user')
Run Code Online (Sandbox Code Playgroud)
我得到这个对象
t {__zone_symbol__state: null, __zone_symbol__value: Array(0)}
Run Code Online (Sandbox Code Playgroud)
我不知道如何操纵它。
我在问是否有办法从我的存储示例中获取字符串值
this.storage.get('user')
Run Code Online (Sandbox Code Playgroud)
ionic3 ×10
angular ×9
ionic2 ×4
typescript ×4
cordova ×2
css ×1
firebase ×1
google-maps ×1
http-post ×1
javascript ×1
mqtt ×1
sqlite ×1
svg ×1