New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

platform_browser_dynamic_1.platformBrowserDynamic is not a function #10732

Closed
dheeraja00 opened this Issue Aug 12, 2016 · 5 comments

Comments

Projects
None yet
5 participants
@dheeraja00
Copy link

dheeraja00 commented Aug 12, 2016

I'm submitting a ... (check one with "x")

[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior
Upgraded to RC5 & getting this error: platform_browser_dynamic_1.platformBrowserDynamic is not a function, below is my main.ts, module.ts & component.ts

// main.ts
import {LocationStrategy, HashLocationStrategy} from '@angular/common';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {HTTP_PROVIDERS} from '@angular/http';
//import {enableProdMode} from '@angular/core';

import {APP_ROUTER_PROVIDERS} from './app/app.routes';
import {AppModule} from './app/app.module';

// enableProdMode()

platformBrowserDynamic().bootstrapModule(AppModule, [
  HTTP_PROVIDERS,
  APP_ROUTER_PROVIDERS,
  { provide: LocationStrategy, useClass: HashLocationStrategy }
])
.catch(err => console.error(err));
// module
import { NgModule }       from '@angular/core';
import { BrowserModule  } from '@angular/platform-browser';
import { App }   from './app';

@NgModule({
    declarations: [App],
    imports:      [BrowserModule],
    bootstrap:    [App],
})
export class AppModule {}
// component
import { Component } from '@angular/core';
import { Router, ActivatedRoute, ROUTER_DIRECTIVES, Event, NavigationEnd, NavigationStart } from '@angular/router';
declare let ga:Function;

@Component({
    selector: 'app',
    pipes: [],
    providers: [],
    directives: [ ROUTER_DIRECTIVES],
    styles: [String(require('../../../static/v4/angular/scss/app.scss'))],
    templateUrl: '../../../templates/v4/angular/app.html'
})
export class App {
    constructor(public router: Router) {
        ga('create', this._AnalyticsCode, {'cookieDomain': 'none'});

        this.router.events.subscribe((event:Event) => {
            if(event instanceof NavigationEnd) {
                ga('send', 'pageview', event.urlAfterRedirects);
            }
        });
    }
}

Please tell us about your environment:

  • Angular version: 2.0.0-rc.5
  • Browser: [all]
@pkozlowski-opensource

This comment has been minimized.

Copy link
Member

pkozlowski-opensource commented Aug 12, 2016

Could you provide a minimal reproduction scenario in a plunker / share more info about your build?

platformBrowserDynamic is well exported from @angular/platform-browser-dynamic, see:
http://plnkr.co/edit/AYjxQ3iBO3tOG8ghV1d4

@pkozlowski-opensource

This comment has been minimized.

Copy link
Member

pkozlowski-opensource commented Aug 17, 2016

Closing as we haven't heard back from the opener.

@eagor

This comment has been minimized.

Copy link

eagor commented Dec 1, 2016

had same issue. The problem was incorrect translation from ES5 DSL to ES6. The code was

// this is wrong for es6
platformBrowserDynamic
        .platformBrowserDynamic()
        .bootstrapModule(AppModule);

but should be

platformBrowserDynamic()
        .bootstrapModule(AppModule);
@TheCraccer

This comment has been minimized.

Copy link

TheCraccer commented May 18, 2018

Apparently, we're having the same issue. Only happens on Android Phones with OS 4.4.4.

Angular Version 6.0.2

@vylesk

This comment has been minimized.

Copy link

vylesk commented Aug 30, 2018

I just had the same issue in a project I'm working on. We're using Angular 5.0.2 and Webpack on Windows in an IIS/ASP.NET project, with our primary browser as Chrome.
My issue randomly appeared after rebooting my PC and loading up my dev environment again (no code or configuration changes).
I managed to resolve the issue after a couple of attempts at starting the project (in Visual Studio) by also browsing to the the app URL Microsoft Edge. It loaded find. I then did a hard refresh (Ctrl+F5) in Chrome and it came good too.
Note: we manually start and leave running Webpack in separate command window, but start the actual application from withing Visual Studio.
My guess is Webpack crapped out behind the scenes and needed some time and a hard refresh in the browser to get the correctly compiled code to the browser again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment