feat(aio): copy example code from angular.io
This commit is contained in:

committed by
Igor Minar

parent
3e34ba01bd
commit
1f3198cb50
55
aio/content/examples/styleguide/js/src/app.js
Normal file
55
aio/content/examples/styleguide/js/src/app.js
Normal file
@ -0,0 +1,55 @@
|
||||
(function(app) {
|
||||
|
||||
// #docregion
|
||||
// #docregion class-w-annotations
|
||||
app.AppComponent =
|
||||
// #docregion component
|
||||
ng.core.Component({
|
||||
selector: 'my-app',
|
||||
// #enddocregion
|
||||
// #docregion view
|
||||
template: '<h1 id="output">My First Angular App</h1>'
|
||||
})
|
||||
// #enddocregion
|
||||
// #docregion class
|
||||
.Class({
|
||||
constructor: function () { }
|
||||
});
|
||||
// #enddocregion
|
||||
// #enddocregion
|
||||
|
||||
// #docregion bootstrap
|
||||
app.AppModule =
|
||||
ng.core.NgModule({
|
||||
imports: [ ng.platformBrowser.BrowserModule ],
|
||||
declarations: [ app.AppComponent ],
|
||||
bootstrap: [ app.AppComponent ]
|
||||
})
|
||||
.Class({
|
||||
constructor: function() {}
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
ng.platformBrowserDynamic
|
||||
.platformBrowserDynamic()
|
||||
.bootstrapModule(app.AppModule);
|
||||
});
|
||||
// #enddocregion
|
||||
// #enddocregion
|
||||
|
||||
})(window.app || (window.app = {}));
|
||||
|
||||
/* Non DSL Approach */
|
||||
(function(app) {
|
||||
|
||||
// #docregion no-dsl
|
||||
app.AppComponent = function AppComponent () {}
|
||||
|
||||
app.AppComponent.annotations = [
|
||||
new ng.core.Component({
|
||||
selector: 'my-app',
|
||||
template: '<h1 id="output">My First Angular App</h1>'
|
||||
})
|
||||
];
|
||||
// #enddocregion
|
||||
})(window.app || (window.app = {}));
|
27
aio/content/examples/styleguide/js/src/index.html
Normal file
27
aio/content/examples/styleguide/js/src/index.html
Normal file
@ -0,0 +1,27 @@
|
||||
<!-- #docregion -->
|
||||
<html>
|
||||
<head>
|
||||
<title>Documentation Style</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
|
||||
<script src="node_modules/core-js/client/shim.min.js"></script>
|
||||
|
||||
<script src="node_modules/zone.js/dist/zone.js"></script>
|
||||
|
||||
<script src="node_modules/rxjs/bundles/Rx.js"></script>
|
||||
<script src="node_modules/@angular/core/bundles/core.umd.js"></script>
|
||||
<script src="node_modules/@angular/common/bundles/common.umd.js"></script>
|
||||
<script src="node_modules/@angular/compiler/bundles/compiler.umd.js"></script>
|
||||
<script src="node_modules/@angular/platform-browser/bundles/platform-browser.umd.js"></script>
|
||||
<script src="node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js"></script>
|
||||
|
||||
<script src='app.js'></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<my-app>foo2</my-app>
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user