Create a index.html:

<!DOCTYPE html>
<html>
<head>
<title>Really Understanding Angular 2 - The Fundamentals</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
<link href="//fonts.googleapis.com/css?family=Roboto:400,300,500,400italic,700" rel="stylesheet" type="text/css">
<link href="//fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://angular-academy.s3-us-west-1.amazonaws.com/styles/angular-academy-lessons-theme-v1.css"> <!-- Polyfill(s) for older browsers -->
<script src="https://npmcdn.com/core-js/client/shim.min.js"></script> <script src="https://npmcdn.com/zone.js@0.6.12?main=browser"></script>
<script src="https://npmcdn.com/reflect-metadata@0.1.3"></script>
<script src="https://npmcdn.com/systemjs@0.19.27/dist/system.src.js"></script>
<script src="/system.config.js"></script>
<script>
document.SYSTEMJS_CONFIG.map.app = '.';
document.SYSTEMJS_CONFIG.packages.app = {main: 'hello_world.ts', defaultExtension: 'ts'};
System.config(document.SYSTEMJS_CONFIG);
System.import('app').catch(function (err) {
console.error(err);
});
</script>
</head>
<body>
<header class="l-header v-center-parent">
<img class="v-center" src="//material.angularjs.org/latest/img/icons/angular-logo.svg">
</header>
<main class="l-main">
<div class="l-course-logo"></div>
<div class="l-course-title">Really Understanding Angular 2 - The Fundamentals</div>
<div class="l-lesson-title">MVC Hello World Component - Controllers and Templates</div>
<div class="l-course-content card card-strong lesson-1">
<!-- Insert your module here -->
</div>
</main>
</body>
</html>

Index.html works as an App Shell, which render meanful pixel onto the screen. And our module will be rendered when the data binding is ready.

Create first Module:

This module will bootstrap our application, normally this only happen once. This is the main entry point of the whole application.

import {Component, NgModule} from "@angular/core";
import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
import {BrowserModule} from "@angular/platform-browser";
@Component({
selector: 'app',
template: `<h1>Hello Angular 2</h1>`
})
export class App{ } /*
* Declare the NgModule
* */
@NgModule({
declarations: [App], // tell which component will be include into this module
imports: [BrowserModule], // if building web app, we need to use BrowserModule, native mobile app use other module
bootstrap: [App] // App component will be the entry point of the whole application
})
export class AppModule{ } // Bootstrap the AppModule
platformBrowserDynamic().bootstrapModule(AppModule);

Last insert out App into html:

        <div class="l-course-content card card-strong lesson-1">
<app></app>
</div>

最新文章

  1. Temp文件夹缺少network service权限,webservice能访问,但是不能调用
  2. 最近兰州的js风格写个插件和一个template engine
  3. 获得servletContext的路径的方法
  4. VBA 按照文件类型名称打开一个文件
  5. hdu 4424 并查集
  6. 【ACM/ICPC2013】线段树题目集合(一)
  7. 【shell文字】mysql每日备份shell文字
  8. [置顶] Spring中DI设置器注入
  9. HashMap,LinkedHashMap,TreeMap对比
  10. LCT总结(LCT,Splay)
  11. java获取时间
  12. 一文掌握 Linux 性能分析之 CPU 篇
  13. 返回上一页 html A标记代码
  14. CefSharp 支持mp4
  15. WLW/OLW 最佳博客写作软件
  16. 如何:为iOS 的方法写注释 让xcode 能够索引得到?
  17. Android WebView中软键盘会遮挡输入框相关问题
  18. svn -- svn配置自动启动
  19. winform 用户控件事件的写法
  20. php五大运行模式CGI,FAST-CGI,CLI,ISAPI,APACHE模式

热门文章

  1. Linux基本命令(4)有关关机和查看系统信息的命令
  2. js代码大全(里面啥都有)
  3. 学习笔记之Linux内核编译过程
  4. webpack入门级教程
  5. MVC3.0在各个版本IIS中的部署
  6. 最小化安装CentOS7 + xfce4 +PHP + nginx +mariadb 开发环境
  7. wuzhicms水印的设置
  8. Annotations:注解
  9. redis高级实用特性
  10. Nginx的配置文件(nginx.conf)解析和领读官网