I follow Angular.io documenation to write a simple "Hello World" application with Angular 2. Once the application runs in the browser, Angular 2 throws a TypeErrorout of angular2/src/browser_adapter.js.
Everything seems to be set up correctly. Think what the problem is?
Console:
TypeError: Array.from is not a function
at createArrayFromMap (http:
at Function.MapWrapper.values (http:
at _createListOfBindings (http:
at Function.Injector.resolve (http:
at Function.Injector.resolveAndCreate (http:
at _createAppInjector (http:
at http:
at Zone.run (http:
at Zone.run (http:
at NgZone.run (http:
all.babel.js (runs for es5 all.js):
import {Component, View, bootstrap} from 'angular2/angular2'
@Component({
selector: 'helloworld'
})
@View({
template: `<h1>Hello World!</h1>`
})
class HelloWorld {
}
bootstrap(HelloWorld)
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Angular 2 Hello World</title>
<script src="./node_modules/rx/dist/rx.all.js" charset="utf-8"></script>
<script src="./node_modules/systemjs/dist/system.js"></script>
<script src="./node_modules/angular2/bundles/angular2.js" charset="utf-8"></script>
<script src="./dist/all.js" charset="utf-8"></script>
</head>
<body>
<helloworld></helloworld>
<script type="text/javascript">
System.config({
baseURL: '/'
, defaultJSExtensions: true
, paths: {
'angular2/*': './node_modules/angular2/*.js'
, 'rx': './node_modules/rx/dist/rx.all.js'
, 'all': './dist/all.js'
}
})
System.import('all')
</script>
</body>
</html>
Replicate https://github.com/agconti/angular-2-hello-world .
source
share