Undan (kelajakda): Iordaniya 2da mavjud bo'lgan cordova_not_ mavjud emas

ionic service -l bilan ionik dasturni ishga tushirganimda, quyidagi xatolarni oling:

Ish vaqti xatosi

     

Undan (so'z bilan): cordova_not_available

Stack

Error: Uncaught (in promise): cordova_not_available
at v (http://localhost:8100/build/polyfills.js:3:4864)
at s (http://localhost:8100/build/polyfills.js:3:4289)
at s (http://localhost:8100/build/polyfills.js:3:4112)
at http://localhost:8100/build/polyfills.js:3:4652
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:10284)
at Object.onInvokeTask (http://localhost:8100/build/main.js:38692:37)
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:10220)
at e.runTask (http://localhost:8100/build/polyfills.js:3:7637)
at i (http://localhost:8100/build/polyfills.js:3:3707)
at HTMLDocument.invoke (http://localhost:8100/build/polyfills.js:3:11437)

boshqa tafsilotlar

Ionic Framework: 2.2.0
Ionic Native: 2.8.1
Ionic App Scripts: 1.1.4
Angular Core: 2.4.8
Angular Compiler CLI: 2.4.8
Node: 6.9.2
OS Platform: Windows 10
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

Quyidagi buyruq bilan HotSpot plaginini o'rnating:

ion plaginini kordova-plugin-hotspot-ni qo'shing

cordova plaginini cordova-plugin-hotspot-ni qo'shing

Usage app.component.ts

import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar, Splashscreen,Hotspot,Network } from 'ionic-native';
import { TabsPage } from '../pages/tabs/tabs';


@Component({
 templateUrl: 'app.html'
})

export class MyApp {
rootPage = TabsPage;

 constructor(platform: Platform) {

  platform.ready().then(() => {
     StatusBar.styleDefault();
     Splashscreen.hide();
     Hotspot.scanWifi().then((networks: Array) => {
     console.log(networks);

 });
})
   }
  }

Shuningdek, boshqa savollar ni ko'rmoqchi bo'lsam ham, muammo.

27

6 javoblar

Brauzerda sinab ko'rilayotganda siz oddiy plaginlardan foydalanasiz. Plaginlarni ishga tushirish uchun test qilish uchun haqiqiy qurilmadan foydalaning.

Kodni brauzerda test qilish uchun (yoki aslida brauzerda sinab ko'rilganda sindirilmaydi) Cordova-ning mavjudligini tekshirish uchun if-statement kerak:

  if (this.platform.is('cordova')) {
   //You're on a device, call the native plugins. Example: 
    //
   //var url: string = '';
   //
   //Camera.getPicture().then((fileUri) => url = fileUri);
  } else {
   //You're testing in browser, do nothing or mock the plugins' behaviour.
    //
   //var url: string = 'assets/mock-images/image.jpg';
  }

EDIT:

Ricky Levi bu erda quyidagi so'zlarni to'g'ri aytganda, Ionic browser platformasini qo'llab-quvvatlaydi. Ushbu platformadan foydalanib, eng ko'p ishlatiladigan plaginlar ishlashga qodir. Ba'zi plaginlar, masalan, shtrixkod-brauzer plaginini emasligini unutmang. skanerlashi bo'lishi kerak bo'lgan qiymatni so'rashni so'raydi. Shtrixli skanerdan foydalanishning barcha usuli yo'qoladi.

54
qo'shib qo'ydi

Ehtimol, o'sha paytdan beri biror narsa o'zgargan bo'lsa-da, Ionic endi brauzerda mavjud bo'lgan "Cordova plaginlari" ni yaratuvchi platforma (va boshqalarni ko'rib chiqish) kabi "brauzer" ni qo'llab-quvvatlaydi.

To use it you add the platform ionic cordova platform add browser

Keyin ionic cordova run android kabi ionic xizmatni ( ionic ish brauzer yoki ionic cordova run iOS )

48
qo'shib qo'ydi
Bu faqat cheklangan miqdordagi plaginlar uchun mavjuddir!
qo'shib qo'ydi muallif JoeriShoeby, manba
Bu men uchun yaxshi ishlaydi. ionic run kodi ionic cordova run deb o'zgartirilganligini unutmang.
qo'shib qo'ydi muallif Micha Schwab, manba

Cordova-ga faqat ilovangizni haqiqiy qurilmada ishlatishingiz mumkin bo'ladi. Brauzerda ilovangizni sinab ko'rganingizda, o'sha mahalliy plaginlardan foydalana olmaysiz.

Haqiqiy qurilmada yoki brauzerda shunday ko'ring:

if (this.platform.is('cordova')) {
 //You are on a device, cordova plugins are accessible
} else {
 //Cordova not accessible, add mock data if necessary
}

Bu faqat sizning ilovangizning kordova plaginlariga tayanmagan qismlarini sinab ko'rishga yordam beradi. Ilovani chindan ham sinab ko'rish uchun qurilmani yoki emulyatorda ishga tushirishingiz kerak.

9
qo'shib qo'ydi
To'g'ri ishlash uchun ushbu ! ni olib tashlashingiz kerak emasmi?
qo'shib qo'ydi muallif Sampath, manba
Bu men uchun ishladi. Konstruktordan tashqarida bo'lsa, uni this bilan to'ldiring
qo'shib qo'ydi muallif DiegoRBaquero, manba
Ha, albatta, rahmat.
qo'shib qo'ydi muallif Andreas Gassmann, manba

Brauzerda ilovani ishga tushirish uchun

Platformani tekshiring

# import {Platform} from 'ionic-angular';
 # constructor(public platform:Platform) {
     if (this.platform.is('core')) {
      this.myPlatform = "Browser";
      console.log('I am on a web browser')
    } else {
      this.mobileDevice = "True"
    }
   }

Cordova qaramligini amalga oshiradigan usullaringizda ushbu tekshiruvlardan foydalaning.

3
qo'shib qo'ydi
Ushbu usul yordamida, #ionicic xizmati hech qanday ogohlantirishsiz ishlaydi
qo'shib qo'ydi muallif Siddharth, manba

Ion View ilovasini yuklab oling va keyin ionli buyruqni ishga tushiring.

Keyin telefonda ilovani oldindan ko'rib chiqa olasiz va mahalliy funktsiyalar ishlaydi.

2
qo'shib qo'ydi

mobil bo'lmagan qurilmada mobil funksiyalarga kirishga harakat qilsangiz, bu xatolik yuzaga keladi, masalan, agar siz mobil telefoningizga kirishni xohlasangiz, sizda cordova javascript kodi va maqsadli platformalar orasidagi bog'lanish zanjiri

eng yaxshi narsa qilish sizning ishlaydigan muhitni test qilish, agar uning kordova, siz kordovaga tushmasangiz

    if (this.platform.is('cordova')) {
   //You're on a mobile device "IOS ANDROID WINDOWS" 
   //now you can call your native plugins
  } else {
   //You're testing in a browser so you may want to use another method or run your code on a emulator
  }
1
qo'shib qo'ydi
Angular Uzbekistan
Angular Uzbekistan
107 ishtirokchilar

Guruh Angular bo'yicha muloqot qilish uchun ochilgan Sizni qiziqtirsa: @nodejs_uz @react_uz @angular_uz @yiiframework_uz @js_uzb @typescript_uzb @vuejs_uz @ngTashkent @laravel_uz @uzdevgroup Ish o'rinlari @UzDev_jobs

ngTashkent
ngTashkent
77 ishtirokchilar

Правила просты: 1. Не хамить 2. Не хейтить 3. Реакт не нужен Ссылки: https://t.me/angular_ru - старший брат https://t.me/angular_uz - ангулар на узбекском @js_uzb @vuejs_uz @react_uz @nodejs_uz @yiiframework_uz @uzdevgroup @UzDev_Jobs @tasdev_talks