diff --git a/.gitignore b/.gitignore index 9b0245f913..6a5519dd4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules www .DS_Store +.idea diff --git a/README.md b/README.md index 0aca3c91c0..37462abe29 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Angular.io is currently the preview site for Angular 2. This site also includes ## Development Setup -1. Install Harp `sudo npm install -g harp` +1. Install Harp `sudo npm install -g harp@v0.15.2` 2. cd into root directory `angular.io/` 3. run `harp server` 4. Open this url in the browser: [http://localhost:9000/](http://localhost:9000/) @@ -25,4 +25,4 @@ Angular.io is currently the preview site for Angular 2. This site also includes ## License -Powered by Google ©2010-2015. Code licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). Documentation licensed under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0/). \ No newline at end of file +Powered by Google ©2010-2015. Code licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). Documentation licensed under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0/). diff --git a/public/_includes/_banner.jade b/public/_includes/_banner.jade index f906e023b3..61de75cac2 100644 --- a/public/_includes/_banner.jade +++ b/public/_includes/_banner.jade @@ -1,2 +1,4 @@ -.banner.is-centered - p.text-body !{banner} \ No newline at end of file +content = banner ? banner : intro + +.banner + p.text-body !{content} \ No newline at end of file diff --git a/public/_includes/_docs-nav.jade b/public/_includes/_docs-nav.jade index afc4cacb13..4f3678a7ab 100644 --- a/public/_includes/_docs-nav.jade +++ b/public/_includes/_docs-nav.jade @@ -3,7 +3,7 @@ nav.side-nav.l-pinned-left.l-layer-4.l-offset-nav form.st-input-inner label(for="search-io" class="is-hidden") Search Docs input(type="search" id="search-io" placeholder="SEARCH DOCS...") - button(class="mobile-trigger button" aria-label="View Docs Menu" ng-click="toggleDocsMenu($event)" md-button) Docs + button(aria-label="Docs Menu" class="mobile-trigger button" aria-label="View Docs Menu" ng-click="toggleDocsMenu($event)" md-button) Docs ul(class="side-nav-primary" ng-class="showDocsNav ? 'is-visible' : ''") if current.path[2] @@ -11,4 +11,45 @@ nav.side-nav.l-pinned-left.l-layer-4.l-offset-nav name = page.menuTitle || page.title selected = current.path[3] == slug ? 'is-selected':'' - li #{name} + // PRIMARY NAVIGATION + if public.docs[current.path[1]][current.path[2]][slug] + li(class="#{selected}") #{name} + + else + li(class="#{selected}") #{name} + + // SECONDARY NAVIGATION + if selected + secondarySection = public.docs[current.path[1]][current.path[2]][current.path[3]] + + if secondarySection + listType = public.docs[current.path[1]][current.path[2]][current.path[3]]._data._listtype || 'unordered' + ordered = listType == "ordered" ? "is-ordered" : "" + number = 0 + + ul(class="side-nav-secondary #{ordered}") + + for page, slug in public.docs[current.path[1]][current.path[2]][current.path[3]]._data + if slug != "index" + name = page.menuTitle || page.title + selected = current.path[4] == slug ? 'is-selected':'' + num = (listType == "ordered") ? number++ : '' + + if slug != "_listtype" + if num + li(class="#{selected}") #{num}. #{page.title} + + else + li(class="#{selected}") #{page.title} + + + // TERTIARY NAVIGATION + if selected + tertiarySection = public.docs[current.path[1]][current.path[2]][current.path[3]][current.path[4]] + + if tertiarySection + ul.side-nav-tertiary + for page, slug in public.docs[current.path[1]][current.path[2]][current.path[3]][current.path[4]]._data + name = page.menuTitle || page.title + selected = current.path[5] == slug ? 'is-selected':'' + li(class="#{selected}")#{name} diff --git a/public/_includes/_footer.jade b/public/_includes/_footer.jade index 0625f4fea2..1c5e453877 100644 --- a/public/_includes/_footer.jade +++ b/public/_includes/_footer.jade @@ -43,5 +43,5 @@ footer(class="background-steel") small.text-caption Powered by Google ©2010-2015. Code licensed under the Apache License, Version 2.0. Documentation licensed under CC BY 3.0. - a(href="/docs/styleguide.html" title="Style Guide" class="styleguide-trigger text-snow" md-button) + a(aria-label="View Style Guide" href="/docs/styleguide.html" title="Style Guide" class="styleguide-trigger text-snow" md-button) span.icon-favorite \ No newline at end of file diff --git a/public/_includes/_head-include.jade b/public/_includes/_head-include.jade index 81c2036de8..5ba36062a6 100644 --- a/public/_includes/_head-include.jade +++ b/public/_includes/_head-include.jade @@ -34,9 +34,10 @@ meta(itemprop="description" content="#{description}") meta(itemprop="image" content="https://angular.io/resources/images/logos/standard/shield-large.png") link(rel="icon" type="image/x-icon" href="/resources/images/icons/favicon.ico") -link(rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/0.7.1/angular-material.min.css") +link(rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/0.8.3/angular-material.min.css") link(href='https://fonts.googleapis.com/css?family=Roboto:400,300,500,400italic,700' rel='stylesheet' type='text/css') link(rel="stylesheet" href="/resources/css/vendor/icomoon/style.css") +link(rel="stylesheet" href="/resources/css/vendor/animate.css") link(rel="stylesheet" href="/resources/css/main.css") diff --git a/public/_includes/_hover-card.jade b/public/_includes/_hover-card.jade new file mode 100644 index 0000000000..64d852f643 --- /dev/null +++ b/public/_includes/_hover-card.jade @@ -0,0 +1,12 @@ +hasIcon = icon ? 'has-icon' : '' +iconNumber = number ? number : '' +a(class="hover-card is-button #{hasIcon}" href="#{url}" md-button) + if icon + span(class="hover-card-icon #{icon}") #{iconNumber} + + h3 #{name} + + if cta + p #{cta} + else + p View #{name} Docs diff --git a/public/_includes/_next-item.jade b/public/_includes/_next-item.jade new file mode 100644 index 0000000000..8fd337e78a --- /dev/null +++ b/public/_includes/_next-item.jade @@ -0,0 +1,22 @@ +currentPage = false +nextPage = false +data = public.docs[current.path[1]][current.path[2]][current.path[3]]._data + +for page, slug in data + + if slug != "index" + // CHECK IF CURRENT PAGE IS SET, THEN SET NEXT PAGE + if currentPage + if !nextPage + .l-sub-section + h3 Next Step + a(href="/docs/#{current.path[1]}/#{current.path[2]}/#{current.path[3]}/#{slug}.html") #{page.title} + + //NEXT PAGE HAS NOW BEEN SET + nextPage = true + + // SET CURRENT PAGE FLAG WHEN YOU PASS IT + if current.path[4] == slug + currentPage = true + + diff --git a/public/_includes/_scripts-include.jade b/public/_includes/_scripts-include.jade index adc7bab4cb..e1c70b6270 100644 --- a/public/_includes/_scripts-include.jade +++ b/public/_includes/_scripts-include.jade @@ -1,13 +1,16 @@ - -script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular.js") -script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-animate.js") -script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-aria.js") -script(src="https://ajax.googleapis.com/ajax/libs/angular_material/0.8.2/angular-material.min.js") - script(src="/resources/js/vendor/prettify.js") script(src="/resources/js/vendor/lang-basic.js") script(src="/resources/js/vendor/lang-dart.js") +script(src="/resources/js/vendor/jquery.js") + + + +script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular.js") +script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-animate.js") +script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-aria.js") +script(src="https://ajax.googleapis.com/ajax/libs/angular_material/0.8.3/angular-material.min.js") + script(src="/resources/js/site.js") diff --git a/public/_includes/_version-dropdown.jade b/public/_includes/_version-dropdown.jade index 9ccc4b1cee..4fd77b376b 100644 --- a/public/_includes/_version-dropdown.jade +++ b/public/_includes/_version-dropdown.jade @@ -11,8 +11,10 @@ if current.path[2] if current.path[3] - page = current.path[3] + '.html' - + if public.docs[current.path[1]][current.path[2]][current.path[3]] + page = current.path[3] + '/' + else + page = current.path[3] + '.html' mixin tree(directory, urlPrefix, name, latest) diff --git a/public/docs/dart/latest/_data.json b/public/docs/dart/latest/_data.json index 4982e87a15..82ecace6b1 100644 --- a/public/docs/dart/latest/_data.json +++ b/public/docs/dart/latest/_data.json @@ -11,9 +11,9 @@ "title": "5 Min Quickstart" }, - "resources": { - "icon": "play-circle-fill", - "title": "Angular Resources", + "guide": { + "icon": "list", + "title": "Step By Step Guide", "banner": "Angular 2 is currently in Alpha Preview. For AngularDart 1.X resources, visit angulardart.org." }, @@ -22,6 +22,12 @@ "title": "API Proposal" }, + "resources": { + "icon": "play-circle-fill", + "title": "Angular Resources", + "banner": "Angular 2 is currently in Alpha Preview. For Angular 1.X Resources please visit Angularjs.org." + }, + "help": { "icon": "chat", "title": "Help & Support" diff --git a/public/docs/dart/latest/guide/_data.json b/public/docs/dart/latest/guide/_data.json new file mode 100644 index 0000000000..2a00b4acf8 --- /dev/null +++ b/public/docs/dart/latest/guide/_data.json @@ -0,0 +1,20 @@ +{ + "_listtype": "ordered", + "setup": { + "title": "Getting Started" + }, + + "index": { + "title": "Step By Step Guide" + }, + + "displaying-data": { + "title": "Displaying Data" + }, + "user-input": { + "title": "User Input" + }, + "making-components": { + "title": "Making Components" + } +} \ No newline at end of file diff --git a/public/docs/dart/latest/guide/_layout.jade b/public/docs/dart/latest/guide/_layout.jade new file mode 100644 index 0000000000..b53b63a3aa --- /dev/null +++ b/public/docs/dart/latest/guide/_layout.jade @@ -0,0 +1,19 @@ +doctype +html(lang="en" ng-app="angularIOApp") + head + != partial("../../../../_includes/_head-include") + + body(class="l-offset-nav l-offset-side-nav" ng-controller="AppCtrl") + != partial("../../../../_includes/_main-nav") + != partial("../../../../_includes/_docs-nav") + != partial("../../../../_includes/_hero") + + if banner + != partial("../../../../_includes/_banner") + + article.l-content-small.grid-fluid.docs-content(ng-non-bindable) + != yield + != partial("../../../../_includes/_next-item") + + != partial("../../../../_includes/_footer") + != partial("../../../../_includes/_scripts-include") \ No newline at end of file diff --git a/public/docs/dart/latest/guide/displaying-data-example1.png b/public/docs/dart/latest/guide/displaying-data-example1.png new file mode 100644 index 0000000000..c5e2c15114 Binary files /dev/null and b/public/docs/dart/latest/guide/displaying-data-example1.png differ diff --git a/public/docs/dart/latest/guide/displaying-data.jade b/public/docs/dart/latest/guide/displaying-data.jade new file mode 100644 index 0000000000..76021c1111 --- /dev/null +++ b/public/docs/dart/latest/guide/displaying-data.jade @@ -0,0 +1,448 @@ +.l-main-section + p. + Displaying data is job number one for any good application. + In Angular, you bind data to elements in HTML + templates, and Angular automatically updates the UI as data changes. + p. + Let's walk through how to display a property and a list of properties, + and then to conditionally show content + based on state. + p. + The final UI looks like this: + figure.image-display + img(src='displaying-data-example1.png') + +.l-main-section + h2#section-create-an-entry-point Create entry points and pubspec + + p. + Open your favorite editor and create a directory with + a web/main.dart file, + a web/index.html file, and + a pubspec.yaml file: + + .code-box + pre.prettyprint.lang-dart(data-name="dart") + code. + // web/main.dart + library displaying_data; + + import 'package:angular2/angular2.dart'; + import 'package:angular2/src/reflection/reflection.dart' show reflector; + import 'package:angular2/src/reflection/reflection_capabilities.dart' show ReflectionCapabilities; + + part 'show_properties.dart'; + + main() { + reflector.reflectionCapabilities = new ReflectionCapabilities(); + bootstrap(DisplayComponent); + } + pre.prettyprint.lang-html(data-name="html") + code. + <!-- web/index.html --> + <!DOCTYPE html> + <html> + <head> + <link rel="stylesheet" href="style.css"> + </head> + <body> + + <display></display> + + <script type="application/dart" src="main.dart"></script> + <script src="packages/browser/dart.js"></script> + </body> + </html> + pre.prettyprint.lang-yaml(data-name="yaml") + code. + # pubspec.yaml + name: displaying_data + description: Dart version of Angular 2 example, Displaying Data + version: 0.0.1 + dependencies: + angular2: 2.0.0-alpha.20 + browser: any + + p. + All of this code should look familiar from the previous page, + except for the library and part statements + in main.dart. + Those statements let you implement part of the app in a different Dart file. + All three of these files remain similar in the rest of the examples, + so we'll just focus on what's different. + +.l-main-section + h2#section-showing-properties-with-interpolation Showing properties with interpolation + p. + The simple method for binding text into templates is through interpolation, + where you put the name of a property + inside {{ }}. + + p. + To see this working, create a Dart file under web + named show_properties.dart, + and add the following: + + pre.prettyprint.lang-dart + code. + // web/show_properties.dart + part of displaying_data; + + @Component( + selector: 'display' + ) + @View( + template: ''' + <p>My name: {{ myName }}</p> + ''' + ) + class DisplayComponent { + String myName = 'Alice'; + } + + p. + You've just defined a component that encompasses a view and controller for the app. The view + defines a template: + + pre.prettyprint.lang-html + code. + <p>My name: {{ myName }}</p> + + p. + Angular will automatically pull the value of myName and + insert it into the browser, + automatically updating it whenever it changes. + + .callout.is-helpful + header Note + p. + While you've used template: to specify an inline view, for larger templates you'd + want to move them to a separate file and load them with templateUrl: instead. + + p. + One thing to notice is that although you've written + your DisplayComponent class, you haven't + used new to instantiate it. + Because your class is associated with <display> elements in + the DOM, Angular automatically calls new on + DisplayComponent and bind its properties to + that part of the template. + + p. + When you're building templates, data bindings like these have access to + the same scope of + properties as your controller class does. + Here your class is DisplayComponent, which has + just one property, myName. + + p. + Add a second line to the template, + so you can see Angular dynamically update content: + + pre.prettyprint.lang-html + code. + <p>Current time: {{ time }}</p> + + p. + Then give the DisplayComponent a starting value for time and + a call to update time + via setInterval: + + pre.prettyprint.lang-dart + code. + class DisplayComponent { + String myName = 'Alice'; + String time; + Timer _timer; + + DisplayComponent() { + _updateTime(null); + _timer = new Timer.periodic(new Duration(seconds: 1), _updateTime); + } + + _updateTime(Timer _) { + time = new DateTime.now().toString(); + } + } + + p Reload the app, and you'll now see the seconds updating automatically. + +.l-main-section + h2#Create-an-array Display an iterable using *for + p Moving up from a single value, create a property that's a list of values. + + pre.prettyprint.lang-dart + code. + class DisplayComponent { + String myName = 'Alice'; + List<String> friendNames = ['Aarav', 'Martín', 'Shannon', 'Ariana', 'Kai']; + } + + p. + You can then use this list in your template with the for directive to create copies of DOM elements + with one for each item in the list. + + pre.prettyprint.lang-dart + code. + @View( + template: ''' + <p>My name: {{ myName }}</p> + <p>Friends:</p> + <ul> + <li *for="#name of friendNames"> + {{ name }} + </li> + </ul> + ''' + ) + p. + To make this work, you'll also need to add the Angular For directive used by + the template to show_properties.dart, so that Angular knows to include it. + Add For using the optional directives parameter, + which contains a list of directives: + + pre.prettyprint.lang-dart + code. + @View( + template: ''' + // ...HTML... + ''', + directives: const[For] + ) + + p Reload and you've got your list of friends! + p. + Again, Angular will mirror changes you make to this list over in the DOM. Add a new item and it appears in your + list. Delete one and Angular deletes the <li>. Reorder items and Angular makes the corresponding reorder of + the DOM list. + + p Let's look at the few lines that do the work again: + + pre.prettyprint.lang-html + code. + <li *for="#name of friendNames"> + {{ name }} + </li> + + p The way to read this is: + ul + li. + *for: Create a DOM element for each item in an + iterable + such as a list. + li #name: Refer to individual values of the iterable as name. + li of friendNames: The iterable to use is called friendNames in the current controller. + + p Using this syntax, you can build UI lists from any iterable object. + +.l-main-section + h2#Create-a-class Create a model and inject it + p. + Before we get too much further, we should mention that putting the model (list) directly into the controller isn't + proper form. We should separate the concerns by having another class serve the role of model and inject it into + the controller. + + p. + Make a FriendsService class to implement a model containing a list of friends. We'll put this in a new + friends_service.dart under web/. Here's what the class looks like: + + pre.prettyprint.lang-dart + code. + // web/friends_service.dart + part of displaying_data; + + class FriendsService { + List<String> friendNames = ['Aarav', 'Martín', 'Shannon', 'Ariana', 'Kai']; + } + + .callout.is-helpful + header Note + p. + Remember to tie friends_service.dart into the library's main file: + add part friends_service.dart to main.dart. + p. + Now you can replace the current list of friends in DisplayComponent. + First add a FriendsService parameter to the constructor. + Then set friendNames to the names provided by the service. + + pre.prettyprint.lang-dart + code. + // In web/show_properties.dart + class DisplayComponent { + String myName = 'Alice'; + List friendNames; + + DisplayComponent(FriendsService friendsService) { + friendNames = friendsService.names; + } + } + + p. + Next, make FriendsService available to dependency injection + by adding an injectables parameter to DisplayComponent's + @Component annotation: + + pre.prettyprint.lang-dart + code. + @Component( + selector: 'display', + injectables: const[FriendsService] + ) + +.l-main-section + h2#Conditionally-displaying-data-with-If Conditionally display data using *if + p. + Lastly, before we move on, let's handle showing parts of our UI conditionally with *if. The + If directive adds or removes elements from the DOM based on the expression you provide. + + p See it in action by adding a paragraph at the end of your template: + + pre.prettyprint.lang-html + code. + <p *if="names.length > 3">You have many friends!</p> + + p. + Also add If to the list of directives, + so Angular knows to include it: + + pre.prettyprint.lang-dart + code. + directives: const[For, If] + p. + The list current has 5 items, so if you run the app you'll see the message + congratulating you on your many friends. + Remove two items from the list, reload your browser, + and see that the message no longer displays. + + + p Here's the final code. + + .code-box + pre.prettyprint.lang-dart(data-name="show_properties.dart") + code. + // web/show_properties.dart + part of displaying_data; + + @Component( + selector: 'display', + injectables: const[FriendsService] + ) + @View( + template: ''' + <p>My name: {{ myName }}</p> + <p>Friends:</p> + <ul> + <li *for="#name of friendNames"> + {{ name }} + </li> + </ul> + ''', + directives: const[For] + ) + class DisplayComponent { + String myName = 'Alice'; + List<String> friendNames; + + DisplayComponent(FriendsService friendsService) { + friendNames = friendsService.names; + } + } + pre.prettyprint.lang-dart(data-name="friends_service.dart") + code. + // web/friends_service.dart + part of displaying_data; + + class FriendsService { + List<String> names = ['Aarav', 'Martín', 'Shannon', 'Ariana', 'Kai']; + } + pre.prettyprint.lang-dart(data-name="main.dart") + code. + // web/main.dart + library displaying_data; + + import 'dart:async'; + + import 'package:angular2/angular2.dart'; + import 'package:angular2/src/reflection/reflection.dart' show reflector; + import 'package:angular2/src/reflection/reflection_capabilities.dart' show ReflectionCapabilities; + + part 'show_properties.dart'; + part 'friends_service.dart'; + + main() { + reflector.reflectionCapabilities = new ReflectionCapabilities(); + bootstrap(DisplayComponent); + } + pre.prettyprint.lang-html(data-name="html") + code. + <!-- web/index.html --> + <!DOCTYPE html> + <html> + <head> + <link rel="stylesheet" href="style.css"> + </head> + <body> + + <display></display> + + <script type="application/dart" src="main.dart"></script> + <script src="packages/browser/dart.js"></script> + </body> + </html> + pre.prettyprint.lang-yaml(data-name="yaml") + code. + # pubspec.yaml + name: displaying_data + description: Dart version of Angular 2 example, Displaying Data + version: 0.0.1 + dependencies: + angular2: 2.0.0-alpha.20 + browser: any +.l-main-section + h2#section-explanations Explanations + + .l-sub-section + h3 Using multiple Dart files in an Angular app + + p. + Dart offers a few ways to implement an app in multiple files. + In this guide, all the code for each example is in a single library; + each Dart file under web is part of that library. + + p. + To let the code in main.dart + use the code in show_properties.dart, + declare a library in main.dart. + Then make show_properties.dart part of that library. + + .code-box + pre.prettyprint.lang-dart(data-name="main library file") + code. + // web/main.dart + library displaying_data; + // imports... + part 'show_properties.dart'; + // Code goes here... + pre.prettyprint.lang-dart(data-name="additional library file") + code. + // web/show_properties.dart + part of displaying_data; + // Code goes here... + + p. + Another way to split Dart code is to + define multiple libraries in a single package. + The additional libraries go under a lib directory + parallel to web. + + + p. + Yet another approach, often used when some of the code is highly reusable, + is to split the code into libraries in two or more packages. + + p. + For more information on implementing Dart libraries, see + Libraries and visibility + in the + Dart language tour. diff --git a/public/docs/dart/latest/guide/index.jade b/public/docs/dart/latest/guide/index.jade new file mode 100644 index 0000000000..66aa7bf4dd --- /dev/null +++ b/public/docs/dart/latest/guide/index.jade @@ -0,0 +1,10 @@ +number = 1; +ul + for page, slug in public.docs[current.path[1]][current.path[2]].guide._data + + if slug != '_listtype' && slug != 'index' + url = "/docs/" + current.path[1] + "/" + current.path[2] + "/" + current.path[3] + "/" + slug + ".html" + num = number++ + + li.c8 + != partial("../../../../_includes/_hover-card", { icon: "icon-number", number: num, name: page.title, url: url }) diff --git a/public/docs/dart/latest/guide/making-components.jade b/public/docs/dart/latest/guide/making-components.jade new file mode 100644 index 0000000000..1295bcb8ed --- /dev/null +++ b/public/docs/dart/latest/guide/making-components.jade @@ -0,0 +1,50 @@ +.l-main-section + p. + As mentioned earlier, you build Angular applications as a tree of nested components. You've seen how to create + a top-level component. You add child components to a parent component by using them in the parent component's + template. + p. + Given a bootstrapping template with a <parent> tag in the body, you can create a parent + component that uses a <child> component like so: + + pre.prettyprint.linenums.lang-dart + code. + part of making_components; + + @Component( + selector: 'parent' + ) + @View( + template: ''' + <h1>{{ message }}</h1> + <child></child> + ''', + directives: const[ChildComponent] + ) + class ParentComponent { + String message = "I'm the parent"; + } + + p You then just need to write the ChildComponent class to make it work: + + pre.prettyprint.linenums.lang-dart + code. + part of making_components; + + @Component( + selector: 'child' + ) + @View( + template: ''' + <p> {{ message }} </p> + ''' + ) + class ChildComponent { + String message = "I'm the child"; + } + + p. + Notice that in addition to using the <child> element in the parent template, you also need to + add ChildComponent in ParentComponent's list of directives + //p. + [TODO: Motivate communication between components with iterator example that passes index to the child] diff --git a/public/docs/dart/latest/guide/setup-example1.png b/public/docs/dart/latest/guide/setup-example1.png new file mode 100644 index 0000000000..c67857149f Binary files /dev/null and b/public/docs/dart/latest/guide/setup-example1.png differ diff --git a/public/docs/dart/latest/guide/setup.jade b/public/docs/dart/latest/guide/setup.jade new file mode 100644 index 0000000000..084143fb78 --- /dev/null +++ b/public/docs/dart/latest/guide/setup.jade @@ -0,0 +1,181 @@ +.l-main-section + + p. + As long as you already + have the Dart SDK, + getting started with Angular 2 is simple: + + ol + li Depend on the angular2 pub package. + li Create a Dart file that defines (directly or indirectly) a + root component and bootstraps Angular. + li Create an HTML file that uses the root component and points to the Dart file + + p. + You can use whichever editor or IDE you like, + or just use the command-line tools that the Dart SDK provides. + See Dart Tools + for more information. + + + h2#section-install Depend on angular2 + + p. + To use Angular2 in your app, include angular2 as a dependency in + your app's pubspec.yaml file. For example: + + pre.prettyprint.lang-yaml + code. + # pubspec.yaml + name: getting_started + description: Dart version of Angular 2 example, Getting Started + version: 0.0.1 + dependencies: + angular2: 2.0.0-alpha.20 + browser: any + p. + Run pub get to download the packages your app depends on. + (Dart-savvy editors and IDEs + typically run pub get for you.) + + +.l-main-section + h2#section-set-up-the-starting-component Write the Dart code + + p. + Next to your pubspec.yaml file, + create a web subdirectory containing a Dart file + (main.dart). + Edit main.dart, adding a component class (AppComponent), + configuring it to bind to the <my-app> element, + and creating a top-level main() function that calls + Angular's bootstrap() function. + + pre.prettyprint.lang-dart + code. + // web/main.dart + import 'package:angular2/angular2.dart'; + import 'package:angular2/src/reflection/reflection.dart' show reflector; + import 'package:angular2/src/reflection/reflection_capabilities.dart' show ReflectionCapabilities; + + @Component( + selector: 'my-app' + ) + @View( + template: '<h1>My first Angular 2 App</h1>' + ) + class AppComponent { + } + + main() { + reflector.reflectionCapabilities = new ReflectionCapabilities(); + bootstrap(AppComponent); + } + +.l-main-section + h2#section-create-an-entry-point Create an HTML file + p. + In the web/ directoryapp, create an HTML file (index.html). + Edit index.html to add a <my-app> element + and call main.dart. + + pre.prettyprint.lang-html + code. + <!-- web/index.html --> + <!DOCTYPE html> + <html> + <head> + <link rel="stylesheet" href="style.css"> + </head> + <body> + <my-app></my-app> + <script type="application/dart" src="main.dart"></script> + <script src="packages/browser/dart.js"></script> + </body> + </html> + +.l-main-section + h2#section-run-it Run the app! + + p. + Now run the app. How you do this depends on your tools. + + ul + li. + If you're using Dart Editor, + right-click web/index.html, + and choose Open in Dartium. + This starts a web server + and opens your app in Dartium, + an experimental version of the Chromium browser that contains the Dart VM. + + li. + If you're using WebStorm or IntelliJ IDEA, + right-click web/index.html, + and choose Run 'index.html'. + + li. + If you're using the command line and don't have Dartium, + serve the app using pub serve, + and then run it by visiting http://localhost:8080 in a browser. + Generating the JavaScript takes a few seconds when you first visit the page, + and the generated JavaScript is currently large. + The generated JavaScript will be smaller once + Angular's transformer becomes available. + + p. + You should see something like this: + + figure.image-display + img(src='setup-example1.png') + +.l-main-section + h2#section-explanations Explanations + + p This basic Angular app contains the structure for any app you'll build. + + .l-sub-section + h3 It's all a tree + + p. + You can think of an Angular app as a tree of components. + The root component acts as the top-level container for the rest of your application. + You've named this one AppComponent, but there's + nothing special about the name; you can use whatever makes sense to you. + + p. + The root component's job is to give a location in the HTML file where + your application can + render through its element—in this case, <my-app>. + There's nothing special about the HTML filename or the element name; + you can pick whatever you like. + + p. + The root component loads the initial template for the application, + which loads other components to perform + whatever functions your application needs—menu bars, views, forms, and so on. + We'll walk through examples of all of + these in the following pages. + + .l-sub-section + h3 @Component and @View annotations + + p. + A component annotation describes details about the component. + An annotation can be identified by its at-sign (@). + p. + The @Component annotation defines the HTML tag for + the component by specifying the component's CSS selector. + p. + The @View annotation defines the HTML that + represents the component. + The component you wrote uses an inline template, + but you can also have an external template. + To use an external template, + specify a templateUrl property and + give it the path to the HTML file. + + + p. + Exciting! Not excited yet? + Let's move on to Displaying Data. diff --git a/public/docs/dart/latest/guide/user-input-example1.png b/public/docs/dart/latest/guide/user-input-example1.png new file mode 100644 index 0000000000..91e2dcfed1 Binary files /dev/null and b/public/docs/dart/latest/guide/user-input-example1.png differ diff --git a/public/docs/dart/latest/guide/user-input.jade b/public/docs/dart/latest/guide/user-input.jade new file mode 100644 index 0000000000..a32b6b8b9a --- /dev/null +++ b/public/docs/dart/latest/guide/user-input.jade @@ -0,0 +1,137 @@ +.l-main-section + p. + You can make your application respond to user input by associating events with functions in your controller + using the event syntax using () to surround the name of an event. + p. + For a particular control like an input you can have it call methods on your controller on keyup event like so: + + pre.prettyprint.lang-html + code. + <input (keyup)="myControllerMethod()"> + p. + As in previous examples, you can make element references available to other parts of the template as a local + variable using the # syntax. With this and events, we can do the old "update text as you type" example: + + pre.prettyprint.lang-html + code. + <input #my-name (keyup)> + <p>{{my-name.value}}</p> + + p.text-body(ng-non-bindable). + The #my-name creates a local variable in the template that we'll refer to below in the + <p> element. The (keyup) tells Angular to trigger updates when it gets a keyup + event. And the {{my-name.value}} binds the text node of the <p> element to the + input's value property. + p Let's do something a little more complex where users enter items and add them to a list like this: + figure.image-display + img(src='user-input-example1.png') + + +.l-main-section + h2#section-create-an-array-property Create an array property + p. + With the default bootstrapping in place, create a TodoController class that will manage interactions with the + list. Inside TodoController, add an array with an initial list of items. Then add a method that pushes new items + on the array when called. + + pre.prettyprint.linenums.lang-dart + code. + class TodoList { + List<String> todos = + ['Eat breakfast', 'Walk dog', 'Breathe', 'Learn Angular']; + + addTodo(String todo) { + todos.add(todo); + } + +.callout.is-helpful + header Production Best Practice + p. + As with the previous example, in a production application you will separate your model out into another class + and inject it into TodoController. We've omitted it here for brevity. + +.l-main-section + h2#section-display-the-list-of-todos Display the list of todos + p. + Using the *for iterator, create an <li> for each item in the todos array and set + its text to the value. + + pre.prettyprint.linenums.lang-html + code. + <ul> + <li *for="#todo of todos"> + {{ todo }} + </li> + </ul> + +.l-main-section + h2#section-add-todos-to-the-list Add todos to the list via button click + p. + Now, add a text input and a button for users to add items to the list. As you saw above, you can create a local + variable reference in your template with #varname. Call it #todotext here. + + pre.prettyprint.lang-html + code. + <input #todotext> + p. + Lastly, specify the target of the click event binding as your controller's addTodo() method and pass + it the value. Since you created a reference called todotext, you can get the value with + todotext.value. + + pre.prettyprint.lang-html + code. + <button (click)="addTodo(todotext.value)">Add Todo</button> + + p And then create the doneTyping() method on TodoList and handle adding the todo text. + + pre.prettyprint.lang-dart + code. + doneTyping(KeyboardEvent event) { + if (event.which == 13) { + InputElement e = event.target; + addTodo(e.value); + e.value = null; + } + } + +.l-main-section + h2#section-final-code Final Code + p Here's the final todo_list.dart + pre.prettyprint.lang-dart + code. + part of user_input; + + @Component( + selector: 'todo-list' + ) + @View( + // Without r before ''' (a raw string), $event breaks Angular! + // An alternative is to use \$event instead. + template: ''' + <ul> + <li *for="#todo of todos"> + {{ todo }} + </li> + </ul> + + <input #todotext (keyup)="doneTyping($event)"> + <button (click)="addTodo(todotext.value)">Add Todo</button> + ''', + directives: const[For] + ) + class TodoList { + List<String> todos = + ['Eat breakfast', 'Walk dog', 'Breathe', 'Learn Angular']; + + addTodo(String todo) { + todos.add(todo); + } + + doneTyping(KeyboardEvent event) { + if (event.which == 13) { + InputElement e = event.target; + addTodo(e.value); + e.value = null; + } + } + } \ No newline at end of file diff --git a/public/docs/dart/latest/index.jade b/public/docs/dart/latest/index.jade index 1e87776524..1783f89814 100644 --- a/public/docs/dart/latest/index.jade +++ b/public/docs/dart/latest/index.jade @@ -1,6 +1,6 @@ div.c4 - md-card + md-card.card md-card-content h3.text-headline.text-uppercase Quickstart p.text-body Learn in 5 minutes @@ -10,21 +10,21 @@ div.c4 div.c4 - md-card + md-card.card md-card-content - h3.text-headline.text-uppercase Resources - p.text-body Preview of v2.0 + h3.text-headline.text-uppercase Guide + p.text-body Step by Step Guide footer - a(href="/docs/#{current.path[1]}/#{current.path[2]}/resources.html" class="button button-primary" md-button) View Resources + a(href="/docs/#{current.path[1]}/#{current.path[2]}/guide/" class="button button-primary" md-button) View Guide div.c4 - md-card + md-card.card md-card-content - h3.text-headline.text-uppercase API Preview - p.text-body Proposal for v2.0 API + h3.text-headline.text-uppercase API + p.text-body API 2.0 Preview footer - a(href="/docs/#{current.path[1]}/#{current.path[2]}/api.html" class="button" md-button) View API + a(href="/docs/#{current.path[1]}/#{current.path[2]}/api/" class="button" md-button) View API diff --git a/public/docs/index.jade b/public/docs/index.jade index 9617f26c7c..9d71df89fc 100644 --- a/public/docs/index.jade +++ b/public/docs/index.jade @@ -1 +1,12 @@ -h1 path #{current.path[0]} +.l-main-section + .l-sub-section + h3 JavaScript + + ul + li Angular 2 JS - Latest Version + + + h3 Dart + + ul + li Angular 2 Dart - Latest Version \ No newline at end of file diff --git a/public/docs/js/latest/_data.json b/public/docs/js/latest/_data.json index ef0ce55dad..be0f486eb8 100644 --- a/public/docs/js/latest/_data.json +++ b/public/docs/js/latest/_data.json @@ -11,15 +11,21 @@ "title": "5 Min Quickstart" }, - "resources": { - "icon": "play-circle-fill", - "title": "Angular Resources", + "guide": { + "icon": "list", + "title": "Step By Step Guide", "banner": "Angular 2 is currently in Alpha Preview. For Angular 1.X Resources please visit Angularjs.org." }, "api": { "icon": "book", - "title": "API Proposal" + "title": "API Preview" + }, + + "resources": { + "icon": "play-circle-fill", + "title": "Angular Resources", + "banner": "Angular 2 is currently in Alpha Preview. For Angular 1.X Resources please visit Angularjs.org." }, "help": { diff --git a/public/docs/js/latest/api.jade b/public/docs/js/latest/api.jade deleted file mode 100644 index e652be232b..0000000000 --- a/public/docs/js/latest/api.jade +++ /dev/null @@ -1,14 +0,0 @@ -.l-main-section - h2 Developer Preview - - p. - The Angular 2.0 API is currently in active development and not production ready. - This page will showcase a preview of proposed methods to help further the discussion - in the development community. - - .l-sub-section - h3 Angular 1.X for Production - p. - If you're building a production app today, please - use Angular 1.X. - These versions of Angular are production ready and available today. diff --git a/public/docs/js/latest/api/_data.json b/public/docs/js/latest/api/_data.json new file mode 100644 index 0000000000..2ba2064dfa --- /dev/null +++ b/public/docs/js/latest/api/_data.json @@ -0,0 +1,49 @@ +{ + "index" : { + "title" : "API 2.0 Preview" + }, + + "annotations" : { + "title" : "Annotations" + }, + + "change_detection" : { + "title" : "Change Detection" + }, + + "core" : { + "title" : "Core" + }, + + "di" : { + "title" : "Di" + }, + + "di_annotations" : { + "title" : "Di Annotations" + }, + + "di_errors" : { + "title" : "Di Errors" + }, + + "directives" : { + "title" : "Directives" + }, + + "forms" : { + "title" : "Forms" + }, + + "pipes" : { + "title" : "Pipes" + }, + + "test" : { + "title" : "Test" + }, + + "view" : { + "title" : "View" + } +} \ No newline at end of file diff --git a/public/docs/js/latest/api/annotations.jade b/public/docs/js/latest/api/annotations.jade new file mode 100644 index 0000000000..ba2b2afc04 --- /dev/null +++ b/public/docs/js/latest/api/annotations.jade @@ -0,0 +1,8 @@ +ul + for page, slug in public.docs[current.path[1]][current.path[2]][current.path[3]][current.path[4]]._data + if slug != 'index' + url = "/docs/" + current.path[1] + "/" + current.path[2] + "/" + current.path[3] + "/" + current.path[4] + "/" + slug + ".html" + + li.c8 + != partial("../../../../_includes/_hover-card", {name: page.title, url: url }) + diff --git a/public/docs/js/latest/api/annotations/Ancestor-class.jade b/public/docs/js/latest/api/annotations/Ancestor-class.jade new file mode 100644 index 0000000000..07658eba0f --- /dev/null +++ b/public/docs/js/latest/api/annotations/Ancestor-class.jade @@ -0,0 +1,72 @@ + +p.location-badge. + exported from angular2/annotations + defined in angular2/src/core/annotations/visibility.js (line 105) + +:markdown + Specifies that an injector should retrieve a dependency from any ancestor element. + + An ancestor is any element between the parent element and shadow root. + + + ## Example + + Here is a simple directive that retrieves a dependency from an ancestor element. + + ``` + @Decorator({ + selector: '[dependency]', + properties: { + 'id':'dependency' + } + }) + class Dependency { + id:string; + } + + + @Decorator({ + selector: '[my-directive]' + }) + class Dependency { + constructor(@Ancestor() dependency:Dependency) { + expect(dependency.id).toEqual(2); + }; + } + ``` + + We use this with the following HTML template: + + ``` +
+
+
+
+
+
+
+ ``` + + The `@Ancestor()` annotation in our constructor forces the injector to retrieve the dependency from the + nearest ancestor element: + - The current element `dependency="3"` is skipped because it is not an ancestor. + - Next parent has no directives `
` + - Next parent has the `Dependency` directive and so the dependency is satisfied. + + Angular injects `dependency=2`. + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + constructor() + + :markdown + + + + diff --git a/public/docs/js/latest/api/annotations/Attribute-class.jade b/public/docs/js/latest/api/annotations/Attribute-class.jade new file mode 100644 index 0000000000..0cd66c3bc2 --- /dev/null +++ b/public/docs/js/latest/api/annotations/Attribute-class.jade @@ -0,0 +1,68 @@ + +p.location-badge. + exported from angular2/annotations + defined in angular2/src/core/annotations/di.js (line 53) + +:markdown + Specifies that a constant attribute value should be injected. + + The directive can inject constant string literals of host element attributes. + + ## Example + + Suppose we have an `` element and want to know its `type`. + + ```html + + ``` + + A decorator can inject string literal `text` like so: + + ```javascript + @Decorator({ + selector: `input' + }) + class InputDecorator { + constructor(@Attribute('type') type) { + // type would be `text` in this example + } + } + ``` + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + constructor(attributeName) + + :markdown + + + + + + .l-sub-section + h3 attributeName + + + :markdown + + + + + + + .l-sub-section + h3 token + + + :markdown + + + + + diff --git a/public/docs/js/latest/api/annotations/Decorator-class.jade b/public/docs/js/latest/api/annotations/Decorator-class.jade new file mode 100644 index 0000000000..39bee5ed34 --- /dev/null +++ b/public/docs/js/latest/api/annotations/Decorator-class.jade @@ -0,0 +1,103 @@ + +p.location-badge. + exported from angular2/annotations + defined in angular2/src/core/annotations/annotations.js (line 755) + +:markdown + Directive that attaches behavior to DOM elements. + + A decorator directive attaches behavior to a DOM element in a composable manner. + (see: http://en.wikipedia.org/wiki/Composition_over_inheritance) + + Decorators: + - are simplest form of Directives. + - are best used as a composition pattern () + + Decorators differ from Components in that they: + - can have multiple decorators per element + - do not create their own evaluation context + - do not have a template (and therefor do not create Shadow DOM) + + + ## Example + + Here we use a decorator directive to simply define basic tool-tip behavior. + + ``` + @Decorator({ + selector: '[tooltip]', + properties: { + 'text': 'tooltip' + }, + hostListeners: { + 'onmouseenter': 'onMouseEnter()', + 'onmouseleave': 'onMouseLeave()' + } + }) + class Tooltip{ + text:string; + overlay:Overlay; // NOT YET IMPLEMENTED + overlayManager:OverlayManager; // NOT YET IMPLEMENTED + + constructor(overlayManager:OverlayManager) { + this.overlay = overlay; + } + + onMouseEnter() { + // exact signature to be determined + this.overlay = this.overlayManager.open(text, ...); + } + + onMouseLeave() { + this.overlay.close(); + this.overlay = null; + } + } + ``` + In our HTML template, we can then add this behavior to a `
` or any other element with the `tooltip` selector, + like so: + + ``` +
+ ``` + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + constructor({ + selector, + properties, + events, + hostListeners, + lifecycle, + compileChildren = true, + }:{ + selector:string, + properties:any, + events:List, + hostListeners:any, + lifecycle:List, + compileChildren:boolean + }={}) + + :markdown + + + + + + .l-sub-section + h3 compileChildren + + + :markdown + If set to true the compiler does not compile the children of this directive. + + + + diff --git a/public/docs/js/latest/api/annotations/DynamicComponent-class.jade b/public/docs/js/latest/api/annotations/DynamicComponent-class.jade new file mode 100644 index 0000000000..b597fa0ac0 --- /dev/null +++ b/public/docs/js/latest/api/annotations/DynamicComponent-class.jade @@ -0,0 +1,90 @@ + +p.location-badge. + exported from angular2/annotations + defined in angular2/src/core/annotations/annotations.js (line 660) + +:markdown + Directive used for dynamically loading components. + + Regular Angular components are statically resolved. DynamicComponent allows to you resolve a component at runtime + instead by providing a placeholder into which a regular Angular component can be dynamically loaded. Once loaded, + the dynamically-loaded component becomes permanent and cannot be changed. + + + ## Example + + Here we have `DynamicComp` which acts as the placeholder for `HelloCmp`. At runtime, the dynamic component + `DynamicComp` requests loading of the `HelloCmp` component. + + There is nothing special about `HelloCmp`, which is a regular Angular component. It can also be used in other static + locations. + + ``` + @DynamicComponent({ + selector: 'dynamic-comp' + }) + class DynamicComp { + helloCmp:HelloCmp; + constructor(loader:DynamicComponentLoader, location:PrivateComponentLocation) { + loader.load(HelloCmp, location).then((helloCmp) => { + this.helloCmp = helloCmp; + }); + } + } + + @Component({ + selector: 'hello-cmp' + }) + @View({ + template: "{{greeting}}" + }) + class HelloCmp { + greeting:string; + constructor() { + this.greeting = "hello"; + } + } + ``` + + + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + constructor({ + selector, + properties, + events, + hostListeners, + injectables, + lifecycle + }:{ + selector:string, + properties:Object, + events:List, + hostListeners:Object, + injectables:List, + lifecycle:List + }={}) + + :markdown + + + + + + .l-sub-section + h3 injectables + + + :markdown + Same as `injectables` in the Component. + + + + diff --git a/public/docs/js/latest/api/annotations/Parent-class.jade b/public/docs/js/latest/api/annotations/Parent-class.jade new file mode 100644 index 0000000000..e0d38cbc76 --- /dev/null +++ b/public/docs/js/latest/api/annotations/Parent-class.jade @@ -0,0 +1,59 @@ + +p.location-badge. + exported from angular2/annotations + defined in angular2/src/core/annotations/visibility.js (line 44) + +:markdown + Specifies that an injector should retrieve a dependency from the direct parent. + + ## Example + + Here is a simple directive that retrieves a dependency from its parent element. + + ``` + @Decorator({ + selector: '[dependency]', + properties: { + 'id':'dependency' + } + }) + class Dependency { + id:string; + } + + + @Decorator({ + selector: '[my-directive]' + }) + class Dependency { + constructor(@Parent() dependency:Dependency) { + expect(dependency.id).toEqual(1); + }; + } + ``` + + We use this with the following HTML template: + + ``` +
+
+
+ ``` + The `@Parent()` annotation in our constructor forces the injector to retrieve the dependency from the + parent element (even thought the current element could resolve it): Angular injects `dependency=1`. + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + constructor() + + :markdown + + + + diff --git a/public/docs/js/latest/api/annotations/PropertySetter-class.jade b/public/docs/js/latest/api/annotations/PropertySetter-class.jade new file mode 100644 index 0000000000..bbb305fb17 --- /dev/null +++ b/public/docs/js/latest/api/annotations/PropertySetter-class.jade @@ -0,0 +1,49 @@ + +p.location-badge. + exported from angular2/annotations + defined in angular2/src/core/annotations/di.js (line 12) + +:markdown + Specifies that a function for setting host properties should be injected. + + NOTE: This is changing pre 1.0. + + The directive can inject a property setter that would allow setting this property on the host element. + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + constructor(propName) + + :markdown + + + + + + .l-sub-section + h3 propName + + + :markdown + + + + + + + .l-sub-section + h3 token + + + :markdown + + + + + diff --git a/public/docs/js/latest/api/annotations/Query-class.jade b/public/docs/js/latest/api/annotations/Query-class.jade new file mode 100644 index 0000000000..cdb806a07e --- /dev/null +++ b/public/docs/js/latest/api/annotations/Query-class.jade @@ -0,0 +1,36 @@ + +p.location-badge. + exported from angular2/annotations + defined in angular2/src/core/annotations/di.js (line 77) + +:markdown + Specifies that a QueryList should be injected. + + See QueryList for usage and example. + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + constructor(directive) + + :markdown + + + + + + .l-sub-section + h3 directive + + + :markdown + + + + + diff --git a/public/docs/js/latest/api/annotations/View-class.jade b/public/docs/js/latest/api/annotations/View-class.jade new file mode 100644 index 0000000000..92842a2ead --- /dev/null +++ b/public/docs/js/latest/api/annotations/View-class.jade @@ -0,0 +1,128 @@ + +p.location-badge. + exported from angular2/annotations + defined in angular2/src/core/annotations/view.js (line 34) + +:markdown + Declares the available HTML templates for an application. + + Each angular component requires a single `@Component` and at least one `@View` annotation. The @View + annotation specifies the HTML template to use, and lists the directives that are active within the template. + + When a component is instantiated, the template is loaded into the component's shadow root, and the + expressions and statements in the template are evaluated against the component. + + For details on the `@Component` annotation, see Component. + + ## Example + + ``` + @Component({ + selector: 'greet' + }) + @View({ + template: 'Hello {{name}}!', + directives: [GreetUser, Bold] + }) + class Greet { + name: string; + + constructor() { + this.name = 'World'; + } + } + ``` + +.l-main-section + h2 Members + .l-sub-section + h3 constructor + + + pre.prettyprint + code. + constructor({ + templateUrl, + template, + directives, + renderer + }: { + templateUrl: string, + template: string, + directives: List<Type>, + renderer: string + }) + + :markdown + + + + + + .l-sub-section + h3 directives + + + :markdown + Specifies a list of directives that can be used within a template. + + Directives must be listed explicitly to provide proper component encapsulation. + + + + ```javascript + @Component({ + selector: 'my-component' + }) + @View({ + directives: [For] + template: ' +
    +
  • {{item}}
  • +
' + }) + class MyComponent { + } + ``` + + + + + + .l-sub-section + h3 renderer + + + :markdown + Specify a custom renderer for this View. + If this is set, neither `template`, `templateURL` nor `directives` are used. + + + + + + .l-sub-section + h3 template + + + :markdown + Specifies an inline template for an angular component. + + NOTE: either `templateURL` or `template` should be used, but not both. + + + + + + .l-sub-section + h3 templateUrl + + + :markdown + Specifies a template URL for an angular component. + + NOTE: either `templateURL` or `template` should be used, but not both. + + + + diff --git a/public/docs/js/latest/api/annotations/Viewport-class.jade b/public/docs/js/latest/api/annotations/Viewport-class.jade new file mode 100644 index 0000000000..3b1d690b3e --- /dev/null +++ b/public/docs/js/latest/api/annotations/Viewport-class.jade @@ -0,0 +1,122 @@ + +p.location-badge. + exported from angular2/annotations + defined in angular2/src/core/annotations/annotations.js (line 884) + +:markdown + Directive that controls the instantiation, destruction, and positioning of inline template elements. + + A viewport directive uses a ViewContainer to instantiate, insert, move, and destroy views at runtime. + The ViewContainer is created as a result of `