/ / Come importare e utilizzare browserDetection in Angular 4? - angolare, angolare4

Come importare e utilizzare browserDetection in Angular 4? - angolare, angolare4

Sto provando a migrare da Angular2 a Angular4, ma in Angular4 ottengo errore:

  • componente:

    import {browserDetection} da "@ angular / platform-browser / testing / src / browser_util";

    if (browserDetection.isWebkit && browserDetection.supportsNativeIntlApi &&! browserDetection.isChromeDesktop && ! browserDetection.isOldChrome) { restituisce nuovo Blob ([nuovo Uint8Array (array) .buffer], {type: mimeString}); }

  • errore nella console:

    Modulo non trovato: errore: impossibile risolvere "@ angular / platform-browser / testing / src / browser_util" in "/ Users / ivan / blablabla / src / app / + client / profilo-cliente / condiviso"

Errore durante l'esecuzione di "npm start". in Angular2 non ci sono errori e tutto funziona e come risolvere questo problema?

risposte:

0 per risposta № 1

Prova a importare pacchetti angolari in app.module.ts

import { NgModule, ApplicationRef } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";

E in main.ts usano i pacchetti di riferimento

import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
import { enableProdMode } from "@angular/core";