Permalink
Browse files

Templates

  • Loading branch information...
1 parent b546a19 commit bf52e3f2f6e4ae967d93b9b17cce75f42af23b51 @mlynch mlynch committed Apr 25, 2015
Showing with 65 additions and 5 deletions.
  1. +13 −0 LICENSE
  2. +1 −0 _includes/sidebar.html
  3. +8 −1 _layouts/default.html
  4. +25 −0 components/index.md
  5. +10 −4 css/style.css
  6. +1 −0 forms/index.md
  7. +7 −0 templates/index.md
View
@@ -0,0 +1,13 @@
+Copyright 2015-present Drifty Co.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
@@ -3,6 +3,7 @@
<ul>
<li><a href="/">Home</a></li>
<li><a href="/components/">Components</a></li>
+ <li><a href="/templates/">Templates</a></li>
<li><a href="/forms/">Forms</a></li>
</ul>
</div>
@@ -4,6 +4,11 @@
{% include head.html %}
<body>
+ {% if page.edit_link %}
+ <div id="improve">
+ <a href="{{page.edit_link}}">Suggest improvements</a>
+ </div>
+ {% endif %}
<div class="container">
<div class="row">
@@ -18,7 +23,9 @@
</div>
<footer id="footer">
- Built by the <a href="http://ionicframework.com/">Ionic</a> Team.
+ <div class="container">
+ Built by the <a href="http://ionicframework.com/">Ionic</a> Team. Licensed under Apache 2.
+ </div>
</footer>
</body>
View
@@ -1,9 +1,34 @@
---
layout: default
title: Components
+edit_link: https://github.com/driftyco/learn-angular2/edit/gh-pages/components/index.md
---
In Angular 2, Components are the main way we build and specify elements and logic on the page.
In Angular 1, we achieved this through directives, controllers, and scope. In Angular 2, all those concepts
are combined into Components.
+
+### A simple component
+
+Let's start with a very simple component that lists out our name:
+
+```javascript
+import {Component, Template} from 'angular2/angular2'
+
+@Component({
+ selector: 'my-component'
+})
+@View({
+ inline: "<div>Hello my name is {{name}}</div>"
+})
+export class MyComponent {
+ constructor() {
+ this.name = 'Max'
+ }
+ sayMyName() {
+ console.log('My name is', this.name)
+ }
+}
+```
+
View
@@ -41,15 +41,21 @@ h3 {
font-size: 24px;
}
+#improve {
+ position: absolute;
+ right: 45px;
+ top: 45px;
+}
+
#sidebar li {
list-style: none;
}
#footer {
- margin: auto;
- max-width: 800px;
- border-top: 1px solid #eee;
- padding: 30px;
margin-top: 20px;
text-align: center;
}
+#footer .container {
+ border-top: 1px solid #eee;
+ padding: 30px;
+}
View
@@ -1,6 +1,7 @@
---
layout: default
title: Forms
+edit_link: https://github.com/driftyco/learn-angular2/edit/gh-pages/forms/index.md
---
Forms are the cornerstone of any real app. In Angular 2, forms have changed quite a bit from their v1 counterpart.
View
@@ -0,0 +1,7 @@
+---
+layout: default
+title: Templates
+edit_link: https://github.com/driftyco/learn-angular2/edit/gh-pages/templates/index.md
+---
+
+Templates are very similar to templates in Angular 1, though there are many small syntactical changes that make it more clear what is happening.

0 comments on commit bf52e3f

Please sign in to comment.