From feabd268fcb7cf1a7ce7350d4a8230bc43d3be00 Mon Sep 17 00:00:00 2001 From: Alex Wolfe Date: Fri, 1 May 2015 06:48:52 -0700 Subject: [PATCH 01/13] restructure directories --- public/_includes/_scripts-include.jade | 7 +- public/about/index.jade | 2 +- .../js/controllers/app-controller.js | 32 +++ public/resources/js/directives/bio.js | 48 +++++ public/resources/js/directives/code-tabs.js | 72 +++++++ public/resources/js/directives/code.js | 23 +++ public/resources/js/site.js | 183 ------------------ 7 files changed, 182 insertions(+), 185 deletions(-) create mode 100644 public/resources/js/controllers/app-controller.js create mode 100644 public/resources/js/directives/bio.js create mode 100644 public/resources/js/directives/code-tabs.js create mode 100644 public/resources/js/directives/code.js delete mode 100644 public/resources/js/site.js diff --git a/public/_includes/_scripts-include.jade b/public/_includes/_scripts-include.jade index 1ff4c4aad1..43ea0e0f5f 100644 --- a/public/_includes/_scripts-include.jade +++ b/public/_includes/_scripts-include.jade @@ -13,8 +13,13 @@ script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria. script(src="https://ajax.googleapis.com/ajax/libs/angular_material/0.8.3/angular-material.min.js") - + script(src="/resources/js/site.js") +script(src="/resources/js/controllers/app-controller.js") +script(src="/resources/js/directives/bio.js") +script(src="/resources/js/directives/code.js") +script(src="/resources/js/directives/code-tabs.js") + script. diff --git a/public/about/index.jade b/public/about/index.jade index bcb00972fa..f12affab52 100644 --- a/public/about/index.jade +++ b/public/about/index.jade @@ -19,7 +19,7 @@ for person, name in bios .c3 - md-card(class="bio-card" data-website="#{person.website}" data-twitter="#{person.twitter}" data-pic="#{person.picture}" data-bio="#{person.bio}" data-name="#{person.name}" ng-click="showBio($event)") + md-card(bio class="bio-card" data-website="#{person.website}" data-twitter="#{person.twitter}" data-pic="#{person.picture}" data-bio="#{person.bio}" data-name="#{person.name}" ng-click="showBio($event)") header image(src="#{person.picture}" alt="#person.name") diff --git a/public/resources/js/controllers/app-controller.js b/public/resources/js/controllers/app-controller.js new file mode 100644 index 0000000000..7ecbda9bbc --- /dev/null +++ b/public/resources/js/controllers/app-controller.js @@ -0,0 +1,32 @@ +/* +* Apllication Controller +* +*/ + +angularIO.controller('AppCtrl', ['$scope', '$mdDialog', function($scope, $mdDialog){ + + $scope.showDocsNav = false; + $scope.showMainNav = false; + $scope.showMenu = false; + + // TOGGLE MAIN NAV (TOP) ON MOBILE + $scope.toggleDocsMenu = function(event) { + event.preventDefault(); + $scope.showDocsNav = !$scope.showDocsNav; + }; + + // TOGGLE DOCS NAV + $scope.toggleMainMenu = function(event) { + event.preventDefault(); + $scope.showMainNav = !$scope.showMainNav; + }; + + // TOGGLE DOCS VERSION & LANGUAGE + $scope.toggleVersionMenu = function(event) { + event.preventDefault(); + $scope.showMenu = !$scope.showMenu; + }; + + // INITIALIZE PRETTY PRINT + prettyPrint(); +}]); \ No newline at end of file diff --git a/public/resources/js/directives/bio.js b/public/resources/js/directives/bio.js new file mode 100644 index 0000000000..ae979c85b5 --- /dev/null +++ b/public/resources/js/directives/bio.js @@ -0,0 +1,48 @@ +angularIO.directive('bio', function($rootScope, $timeout) { + return { + restrict: 'A', + replace: true, + scope: {}, + link: function (scope, element, attrs) { + var name = element.attr('data-name'); + var bio = element.attr('data-bio'); + var pic = element.attr('data-pic'); + var twitter = element.attr('data-twitter'); + var website = element.attr('data-website'); + var $twitter = twitter !== 'undefined' ? 'Twitter' : ''; + var $website = website !== 'undefined' ? 'Website' : ''; + + scope.showBio = function(event) { + $mdDialog.show({ + parent: angular.element(document.body), + targetEvent: $event, + template: + '' + + ' ' + + ' ' + + '

' + name + '

' + + ' ' + + '

' + bio + '

' + + '
' + + '
' + + ' ' + + ' Close Bio' + + ' ' + + '
' + + '
', + locals: { + items: $scope.items + }, + controller: DialogController + }); + }; + + function DialogController(scope, $mdDialog, items) { + scope.items = items; + scope.closeDialog = function() { + $mdDialog.hide(); + }; + } + } + }; +}); \ No newline at end of file diff --git a/public/resources/js/directives/code-tabs.js b/public/resources/js/directives/code-tabs.js new file mode 100644 index 0000000000..e33048b239 --- /dev/null +++ b/public/resources/js/directives/code-tabs.js @@ -0,0 +1,72 @@ +/* +* Code Tabs +* +*/ + +angularIO.directive('code-tabs', function() { + return { + template: 'Name: {{customer.name}} Address: {{customer.address}}' + }; + + + $scope.language = 'es5'; + var $codeBoxes = $('.code-box'); + + if($codeBoxes.length) { + //UPDATE ALL CODE BOXES + $codeBoxes.each(function(index, codeBox) { + //REGISTER ELEMENTS + var $codeBox = $(codeBox); + var $examples = $codeBox.find('.prettyprint'); + var $firstItem = $($examples[0]); + var $header = $("
"); + var $nav = $(""); + var selectedName = ''; + + //HIDE/SHOW CONTENT + $examples.addClass('is-hidden'); + $firstItem.removeClass('is-hidden'); + + //UPDATE NAV FOR EACH CODE BOX + $examples.each(function(index, example) { + var $example = $(example); + var name = $example.data('name'); + var selected = (index === 0) ? 'is-selected' : ''; + var $button = $(""); + + // ADD EVENTS FOR CODE SNIPPETS + $button.on('click', function(e) { + e.preventDefault(); + var $currentButton = $(e.currentTarget); + var $buttons = $nav.find('.button'); + var selectedName = $currentButton.data('name'); + $buttons.removeClass('is-selected'); + $currentButton.addClass('is-selected'); + + //UPDAT VIEW ON SELECTTION + $examples.addClass('is-hidden'); + var $currentExample = $codeBox.find(".prettyprint[data-name='" + selectedName + "']"); + $currentExample.removeClass('is-hidden').addClass('animated fadeIn'); + }); + + $nav.append($button); + }); + + //ADD HEADER TO DOM + $header.append($nav); + $codeBox.prepend($header); + }); + + //FADEIN EXAMPLES + $codeBoxes.addClass('is-visible'); + } + + // TOGGLE CODE LANGUAGE + $scope.toggleCodeExample = function(event, name) { + event.preventDefault(); + $scope.language = language; + }; + + +}); + diff --git a/public/resources/js/directives/code.js b/public/resources/js/directives/code.js new file mode 100644 index 0000000000..fe8d5c5309 --- /dev/null +++ b/public/resources/js/directives/code.js @@ -0,0 +1,23 @@ +/* +* Code Formatting +* +*/ + + +angularIO.directive('pre', function() { + return { + template: 'Name: {{customer.name}} Address: {{customer.address}}' + }; + + + if($codeBlocks.length) { + $codeBlocks.each(function(index, codeEl) { + var $codeEl = $(codeEl); + + if(!$codeEl.hasClass('prettyprint')) { + $codeEl.addClass('prettyprint linenums'); + } + }); + } + +}); \ No newline at end of file diff --git a/public/resources/js/site.js b/public/resources/js/site.js deleted file mode 100644 index 2a31633f07..0000000000 --- a/public/resources/js/site.js +++ /dev/null @@ -1,183 +0,0 @@ -/* -* Apllication Module -* -*/ - -var angularIO = angular.module('angularIOApp', ['ngMaterial', 'ngTouch']) -.config(function($mdThemingProvider) { - $mdThemingProvider.theme('default') - .primaryPalette('blue', { - 'default': '700', // by default use shade 400 from the pink palette for primary intentions - 'hue-1': '100', // use shade 100 for the md-hue-1 class - 'hue-2': '600', // use shade 600 for the md-hue-2 class - 'hue-3': 'A100' // use shade A100 for the md-hue-3 class - }) - // If you specify less than all of the keys, it will inherit from the - // default shades - .accentPalette('purple', { - 'default': '200' // use shade 200 for default, and keep all other shades the same - }); -}); - - -/* -* Apllication Controller -* -*/ - -angularIO.controller('AppCtrl', ['$scope', '$mdDialog', function($scope, $mdDialog){ - - $scope.showDocsNav = false; - $scope.showMainNav = false; - $scope.showMenu = false; - - // TOGGLE MAIN NAV (TOP) ON MOBILE - $scope.toggleDocsMenu = function(event) { - event.preventDefault(); - $scope.showDocsNav = !$scope.showDocsNav; - }; - - // TOGGLE DOCS NAV - $scope.toggleMainMenu = function(event) { - event.preventDefault(); - $scope.showMainNav = !$scope.showMainNav; - }; - - // TOGGLE DOCS VERSION & LANGUAGE - $scope.toggleVersionMenu = function(event) { - event.preventDefault(); - $scope.showMenu = !$scope.showMenu; - }; - - - /* - * Code Switcher - * - */ - - $scope.language = 'es5'; - var $codeBoxes = $('.code-box'); - - if($codeBoxes.length) { - //UPDATE ALL CODE BOXES - $codeBoxes.each(function(index, codeBox) { - //REGISTER ELEMENTS - var $codeBox = $(codeBox); - var $examples = $codeBox.find('.prettyprint'); - var $firstItem = $($examples[0]); - var $header = $("
"); - var $nav = $(""); - var selectedName = ''; - - //HIDE/SHOW CONTENT - $examples.addClass('is-hidden'); - $firstItem.removeClass('is-hidden'); - - //UPDATE NAV FOR EACH CODE BOX - $examples.each(function(index, example) { - var $example = $(example); - var name = $example.data('name'); - var selected = (index === 0) ? 'is-selected' : ''; - var $button = $(""); - - // ADD EVENTS FOR CODE SNIPPETS - $button.on('click', function(e) { - e.preventDefault(); - var $currentButton = $(e.currentTarget); - var $buttons = $nav.find('.button'); - var selectedName = $currentButton.data('name'); - $buttons.removeClass('is-selected'); - $currentButton.addClass('is-selected'); - - //UPDAT VIEW ON SELECTTION - $examples.addClass('is-hidden'); - var $currentExample = $codeBox.find(".prettyprint[data-name='" + selectedName + "']"); - $currentExample.removeClass('is-hidden').addClass('animated fadeIn'); - }); - - $nav.append($button); - }); - - //ADD HEADER TO DOM - $header.append($nav); - $codeBox.prepend($header); - }); - - //FADEIN EXAMPLES - $codeBoxes.addClass('is-visible'); - } - - // TOGGLE CODE LANGUAGE - $scope.toggleCodeExample = function(event, name) { - event.preventDefault(); - $scope.language = language; - }; - - /* - * Code Formatting - * - */ - - var $codeBlocks = $('pre'); - - if($codeBlocks.length) { - $codeBlocks.each(function(index, codeEl) { - var $codeEl = $(codeEl); - - if(!$codeEl.hasClass('prettyprint')) { - $codeEl.addClass('prettyprint linenums'); - } - }); - } - - // BIO MODAL - $scope.showBio = function($event) { - var parentEl = angular.element(document.body); - var person = angular.element($event.currentTarget); - var name = person.attr('data-name'); - var bio = person.attr('data-bio'); - var pic = person.attr('data-pic'); - var twitter = person.attr('data-twitter'); - var website = person.attr('data-website'); - var $twitter = twitter !== 'undefined' ? 'Twitter' : ''; - var $website = website !== 'undefined' ? 'Website' : ''; - - $mdDialog.show({ - parent: parentEl, - targetEvent: $event, - template: - '' + - ' ' + - ' ' + - '

' + name + '

' + - ' ' + - '

' + bio + '

' + - '
' + - '
' + - ' ' + - ' Close Bio' + - ' ' + - '
' + - '
', - locals: { - items: $scope.items - }, - controller: DialogController - }); - - function DialogController(scope, $mdDialog, items) { - scope.items = items; - scope.closeDialog = function() { - $mdDialog.hide(); - }; - } - }; - - - // INITIALIZE PRETTY PRINT - prettyPrint(); -}]); - - - - From 47e25571fd166c7b81e16639eac1427eefc3f3fe Mon Sep 17 00:00:00 2001 From: Alex Wolfe Date: Fri, 1 May 2015 06:49:07 -0700 Subject: [PATCH 02/13] updated site file --- public/resources/js/site.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 public/resources/js/site.js diff --git a/public/resources/js/site.js b/public/resources/js/site.js new file mode 100644 index 0000000000..6306072d0b --- /dev/null +++ b/public/resources/js/site.js @@ -0,0 +1,22 @@ +/* +* Apllication Module +* +*/ + +var angularIO = angular.module('angularIOApp', ['ngMaterial', 'ngTouch']) +.config(function($mdThemingProvider) { + + // THEMEING FOR ANGULAR MATERIAL + $mdThemingProvider.theme('default') + .primaryPalette('blue', { + 'default': '700', // by default use shade 400 from the pink palette for primary intentions + 'hue-1': '100', // use shade 100 for the md-hue-1 class + 'hue-2': '600', // use shade 600 for the md-hue-2 class + 'hue-3': 'A100' // use shade A100 for the md-hue-3 class + }) + // If you specify less than all of the keys, it will inherit from the + // default shades + .accentPalette('purple', { + 'default': '200' // use shade 200 for default, and keep all other shades the same + }); +}); \ No newline at end of file From 6475fb7e5132a3c550812e97defe0aaabfee2698 Mon Sep 17 00:00:00 2001 From: Alex Wolfe Date: Fri, 1 May 2015 07:40:25 -0700 Subject: [PATCH 03/13] bio directive --- public/_includes/_scripts-include.jade | 1 - public/about/index.jade | 2 +- public/resources/js/directives/bio.js | 31 +++++++++++++------------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/public/_includes/_scripts-include.jade b/public/_includes/_scripts-include.jade index 43ea0e0f5f..ead15fbb4e 100644 --- a/public/_includes/_scripts-include.jade +++ b/public/_includes/_scripts-include.jade @@ -2,7 +2,6 @@ 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") diff --git a/public/about/index.jade b/public/about/index.jade index f12affab52..35a4c015ac 100644 --- a/public/about/index.jade +++ b/public/about/index.jade @@ -19,7 +19,7 @@ for person, name in bios .c3 - md-card(bio class="bio-card" data-website="#{person.website}" data-twitter="#{person.twitter}" data-pic="#{person.picture}" data-bio="#{person.bio}" data-name="#{person.name}" ng-click="showBio($event)") + md-card(biocard class="bio-card" data-website="#{person.website}" data-twitter="#{person.twitter}" data-pic="#{person.picture}" data-bio="#{person.bio}" data-name="#{person.name}") header image(src="#{person.picture}" alt="#person.name") diff --git a/public/resources/js/directives/bio.js b/public/resources/js/directives/bio.js index ae979c85b5..5ab54a1d2a 100644 --- a/public/resources/js/directives/bio.js +++ b/public/resources/js/directives/bio.js @@ -1,28 +1,27 @@ -angularIO.directive('bio', function($rootScope, $timeout) { +angularIO.directive('biocard', function($rootScope, $timeout, $mdDialog) { return { restrict: 'A', - replace: true, scope: {}, link: function (scope, element, attrs) { - var name = element.attr('data-name'); - var bio = element.attr('data-bio'); - var pic = element.attr('data-pic'); - var twitter = element.attr('data-twitter'); - var website = element.attr('data-website'); - var $twitter = twitter !== 'undefined' ? 'Twitter' : ''; - var $website = website !== 'undefined' ? 'Website' : ''; + scope.name = element.attr('data-name'); + scope.bio = element.attr('data-bio'); + scope.pic = element.attr('data-pic'); + scope.twitter = element.attr('data-twitter'); + scope.website = element.attr('data-website'); + scope.$twitter = scope.twitter !== 'undefined' ? 'Twitter' : ''; + scope.$website = scope.website !== 'undefined' ? 'Website' : ''; - scope.showBio = function(event) { + element.on('click', function($event) { $mdDialog.show({ parent: angular.element(document.body), targetEvent: $event, template: '' + ' ' + - ' ' + - '

' + name + '

' + - ' ' + - '

' + bio + '

' + + ' ' + + '

' + scope.name + '

' + + ' ' + + '

' + scope.bio + '

' + '
' + '
' + ' ' + @@ -31,11 +30,11 @@ angularIO.directive('bio', function($rootScope, $timeout) { '
' + '
', locals: { - items: $scope.items + items: scope.items }, controller: DialogController }); - }; + }); function DialogController(scope, $mdDialog, items) { scope.items = items; From b9386de4f3e87ed10f51ee514ebac5a85a2f87da Mon Sep 17 00:00:00 2001 From: Alex Wolfe Date: Sat, 2 May 2015 15:34:16 -0700 Subject: [PATCH 04/13] code tabs, and code example directive --- public/_includes/_scripts-include.jade | 3 +- public/docs/js/latest/guide/_layout.jade | 2 +- public/resources/css/module/_code-box.scss | 5 +- .../resources/js/directives/code-example.js | 28 ++++ public/resources/js/directives/code-pane.js | 33 +++++ public/resources/js/directives/code-tabs.js | 122 ++++++++---------- public/resources/js/directives/code.js | 23 ---- 7 files changed, 121 insertions(+), 95 deletions(-) create mode 100644 public/resources/js/directives/code-example.js create mode 100644 public/resources/js/directives/code-pane.js delete mode 100644 public/resources/js/directives/code.js diff --git a/public/_includes/_scripts-include.jade b/public/_includes/_scripts-include.jade index ead15fbb4e..50142fb58e 100644 --- a/public/_includes/_scripts-include.jade +++ b/public/_includes/_scripts-include.jade @@ -16,8 +16,9 @@ script(src="https://ajax.googleapis.com/ajax/libs/angular_material/0.8.3/angular script(src="/resources/js/site.js") script(src="/resources/js/controllers/app-controller.js") script(src="/resources/js/directives/bio.js") -script(src="/resources/js/directives/code.js") script(src="/resources/js/directives/code-tabs.js") +script(src="/resources/js/directives/code-pane.js") +script(src="/resources/js/directives/code-example.js") diff --git a/public/docs/js/latest/guide/_layout.jade b/public/docs/js/latest/guide/_layout.jade index 41824d43f5..35040681c8 100644 --- a/public/docs/js/latest/guide/_layout.jade +++ b/public/docs/js/latest/guide/_layout.jade @@ -9,7 +9,7 @@ html(lang="en" ng-app="angularIOApp") != partial("../../../../_includes/_hero") != partial("../../../../_includes/_banner") - article.l-content-small.grid-fluid.docs-content(ng-non-bindable) + article.l-content-small.grid-fluid.docs-content != yield != partial("../../../../_includes/_next-item") diff --git a/public/resources/css/module/_code-box.scss b/public/resources/css/module/_code-box.scss index bbd1f8ac81..00784634a6 100644 --- a/public/resources/css/module/_code-box.scss +++ b/public/resources/css/module/_code-box.scss @@ -2,7 +2,6 @@ border-radius: 4px; background: $steel; box-shadow: 0px 2px 5px rgba($coal, .3); - display: none; margin-bottom: $unit * 2; header { @@ -24,7 +23,9 @@ font-weight: 500; text-transform: none; - &.is-selected { + &.is-selected, + &.selected + { background: $blueberry; color: $snow; } diff --git a/public/resources/js/directives/code-example.js b/public/resources/js/directives/code-example.js new file mode 100644 index 0000000000..06e7811787 --- /dev/null +++ b/public/resources/js/directives/code-example.js @@ -0,0 +1,28 @@ +/* +* Code Example Directive +* +* Formats codes examples and prevents +* Angular code from being processed. +*/ + +angularIO.directive('codeExample', function() { + return { + restrict: 'E', + transclude: true, + replace: true, + scope: { + name: '@', + language: '@', + format: '@' + }, + + link: function(scope, element, attrs, codeSwitchController, transcludeFunc) { + transcludeFunc( scope, function( content ) { + var code = '' + content[0].innerHTML + ''; + element.append(code); + }); + }, + + template:'
'
+  };
+});
\ No newline at end of file
diff --git a/public/resources/js/directives/code-pane.js b/public/resources/js/directives/code-pane.js
new file mode 100644
index 0000000000..89e53005c5
--- /dev/null
+++ b/public/resources/js/directives/code-pane.js
@@ -0,0 +1,33 @@
+/*
+* Code Pane Directive
+*
+* @requires codeTab Directive
+*
+* Invidiual panes displayed in the the
+* codeTab elements
+*/
+
+angularIO.directive('codePane', function() {
+  return {
+    require: '^codeTabs',
+    restrict: 'E',
+    transclude: true,
+    replace: true,
+    scope: {
+      name: '@',
+      language: '@',
+      format: '@'
+    },
+
+    link: function(scope, element, attrs, codeTabController, transcludeFunc) {
+      transcludeFunc( scope, function( content ) {
+        var code = '' + content[0].innerHTML + '';
+        element.append(code);
+      });
+
+      codeTabController.addPane(scope);
+    },
+
+    template:'
'
+  };
+});
\ No newline at end of file
diff --git a/public/resources/js/directives/code-tabs.js b/public/resources/js/directives/code-tabs.js
index e777e39bb9..bd309cb3c6 100644
--- a/public/resources/js/directives/code-tabs.js
+++ b/public/resources/js/directives/code-tabs.js
@@ -1,85 +1,71 @@
 /*
-* Code Tabs
+* Code Tabs Directive
 *
+* Creates a tabs code examples that
+* displayed in the same container
 */
 
-var getTabName = function(name) {
-  var prettyName = name;
-
-  switch(name) {
-    case 'es5':         prettyName = 'ES5';         break;
-    case 'typescript':  prettyName = 'TypeScript';  break;
-    default:            prettyName = name;
-  }
-
-  return prettyName;
-};
-
-angularIO.directive('code-tabs', function() {
+angularIO.directive('codeTabs', function($timeout) {
   return {
-    template: 'Name: {{customer.name}} Address: {{customer.address}}'
-  };
+    restrict: 'E',
+    scope: {},
+    transclude: true,
+    replace: true,
+
+    controller: function ($scope) {
+      $scope.panes = [];
 
 
-  $scope.language = 'es5';
-  var $codeBoxes = $('.code-box');
+      /*
+      * Add Code Pane List of Panes
+      *
+      */
 
-  if($codeBoxes.length) {
-    //UPDATE ALL CODE BOXES
-    $codeBoxes.each(function(index, codeBox) {
-      //REGISTER ELEMENTS
-      var $codeBox = $(codeBox);
-      var $examples = $codeBox.find('.prettyprint');
-      var $firstItem = $($examples[0]);
-      var $header = $("
"); - var $nav = $(""); - var selectedName = ''; + this.addPane = function(pane) { + if ($scope.panes.length === 0) { + $scope.showPane(pane); + } - //HIDE/SHOW CONTENT - $examples.addClass('is-hidden'); - $firstItem.removeClass('is-hidden'); + $scope.panes.push(pane); + }; - //UPDATE NAV FOR EACH CODE BOX - $examples.each(function(index, example) { - var $example = $(example); - var name = $example.data('name'); - var tabName = getTabName(name); - var selected = (index === 0) ? 'is-selected' : ''; - var $button = $(""); - // ADD EVENTS FOR CODE SNIPPETS - $button.on('click', function(e) { - e.preventDefault(); - var $currentButton = $(e.currentTarget); - var $buttons = $nav.find('.button'); - var selectedName = $currentButton.data('name'); - $buttons.removeClass('is-selected'); - $currentButton.addClass('is-selected'); + /* + * Show selected Code Examples + * + */ - //UPDAT VIEW ON SELECTTION - $examples.addClass('is-hidden'); - var $currentExample = $codeBox.find(".prettyprint[data-name='" + selectedName + "']"); - $currentExample.removeClass('is-hidden').addClass('animated fadeIn'); + $scope.showPane = function(pane) { + // RESET ALL EXAMPLES + angular.forEach($scope.panes, function(pane) { + pane.selected = false; }); - $nav.append($button); + // SELECT CURRENT EXAMPLE + pane.selected = true; + }; + + + /* + * Finish Rendereding then prettify code + * + */ + + $scope.$watch($scope.panes.$last,function(){ + $timeout(prettyPrint, 1); }); + }, - //ADD HEADER TO DOM - $header.append($nav); - $codeBox.prepend($header); - }); - - //FADEIN EXAMPLES - $codeBoxes.addClass('is-visible'); - } - - // TOGGLE CODE LANGUAGE - $scope.toggleCodeExample = function(event, name) { - event.preventDefault(); - $scope.language = language; + template: + '
' + + '
' + + ' ' + + '
' + + '
' + + '
' }; - - -}); - +}); \ No newline at end of file diff --git a/public/resources/js/directives/code.js b/public/resources/js/directives/code.js deleted file mode 100644 index fe8d5c5309..0000000000 --- a/public/resources/js/directives/code.js +++ /dev/null @@ -1,23 +0,0 @@ -/* -* Code Formatting -* -*/ - - -angularIO.directive('pre', function() { - return { - template: 'Name: {{customer.name}} Address: {{customer.address}}' - }; - - - if($codeBlocks.length) { - $codeBlocks.each(function(index, codeEl) { - var $codeEl = $(codeEl); - - if(!$codeEl.hasClass('prettyprint')) { - $codeEl.addClass('prettyprint linenums'); - } - }); - } - -}); \ No newline at end of file From a5f3214e9770e42db514b7061fe5e4d20942e155 Mon Sep 17 00:00:00 2001 From: Alex Wolfe Date: Sun, 3 May 2015 19:09:25 -0700 Subject: [PATCH 05/13] Code examples, now escape html, full directives --- public/_includes/_scripts-include.jade | 3 +- .../_includes/styleguide/_code-examples.jade | 63 ++++---- .../docs/_includes/styleguide/_layouts.jade | 19 +-- .../js/controllers/app-controller.js | 11 +- .../resources/js/directives/code-example.js | 29 ++-- public/resources/js/directives/code-pane.js | 36 +++-- public/resources/js/directives/code-tabs.js | 10 -- public/resources/js/site.js | 2 +- public/resources/js/vendor/lodash.js | 142 ++++++++++++++++++ 9 files changed, 232 insertions(+), 83 deletions(-) create mode 100644 public/resources/js/vendor/lodash.js diff --git a/public/_includes/_scripts-include.jade b/public/_includes/_scripts-include.jade index 50142fb58e..eb857ef883 100644 --- a/public/_includes/_scripts-include.jade +++ b/public/_includes/_scripts-include.jade @@ -2,16 +2,17 @@ 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/lodash.js") script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js") -script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-touch.js") script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.js") script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/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") script(src="/resources/js/controllers/app-controller.js") diff --git a/public/docs/_includes/styleguide/_code-examples.jade b/public/docs/_includes/styleguide/_code-examples.jade index d93b23c82c..0b3ffb3639 100644 --- a/public/docs/_includes/styleguide/_code-examples.jade +++ b/public/docs/_includes/styleguide/_code-examples.jade @@ -7,22 +7,16 @@ .l-sub-section h3 Adding a code example - pre.prettyprint.linenums - code. - pre.prettyprint.linenums - code. - //SOME CODE - var name = "Alex Wolfe"; - alert(name); + code-example(format="linenums"). + //SOME CODE + var name = "Alex Wolfe"; + alert(name); .l-sub-section h3 Specify starting line number - pre(class="prettyprint linenums:4") - code. - pre.prettyprint.linenums:4 - var title = "This starts on line four"; - + code-example(language="html" format="linenums:4"). + var title = "This starts on line four"; .l-sub-section h3 Specify a language @@ -34,11 +28,9 @@ chosen based on language hints. Add a class that matches your desired language (example below uses .lang-html) - pre(class="prettyprint lang-html") - code. - pre.prettyprint.lang-html - h1 Title - p This is some copy... + code-example(language="html" format="linenums"). + h1 Title + p This is some copy... .l-sub-section h3 Code Highlighting @@ -48,16 +40,31 @@ Black. You can see examples below and the class names needed for each type. - pre.prettyprint.linenums - code. - // Pink Background Version - // class="pnk" - var elephants = "The pink elephants were marching..."; + code-example(format="linenums" escape="html"). + // Pink Background Version + // class="pnk" + var elephants = "The pink elephants were marching..."; - // Black Background Version - // class="blk" - var night = "The night was pitch black."; + // Black Background Version + // class="blk" + var night = "The night was pitch black."; - // Outlined Version - // class="otl" - var match = "The bird ate bird seed near the bird bath "; + // Outlined Version + // class="otl" + var match = "The bird ate bird seed near the bird bath "; + + .l-sub-section + h3 Code Tabs + p. + Code Tabs are a great way to show different languages and versions + of a particular piece of code. When using these tabs make sure the + content is always related. + + code-tabs + code-pane(language="javascript" format="linenums" name="ES5"). + // ES5 + var hello = 'blah'; + + code-pane(language="javascript" format="linenums" name="TypeScript"). + // TypeScript + var hello = 'blah'; diff --git a/public/docs/_includes/styleguide/_layouts.jade b/public/docs/_includes/styleguide/_layouts.jade index 8b21f4790e..904e8de0aa 100644 --- a/public/docs/_includes/styleguide/_layouts.jade +++ b/public/docs/_includes/styleguide/_layouts.jade @@ -10,20 +10,17 @@ h2 Main Section Title p Main section content... - pre.prettyprint.linenums.lang-html - code. - .l-main-section - h2 Section Title - p section content... - + code-example(language="html" format="linenums"). + .l-main-section + h2 Section Title + p section content... .l-sub-section h3 Sub Section Title p. sub section content... This content is related to the main section content and falls within the main section. - pre.prettyprint.linenums.lang-html - code. - .l-sub-section - h3 Sub Section Title - p sub section content... \ No newline at end of file + code-example(language="html" format="linenums"). + .l-sub-section + h3 Sub Section Title + p sub section content... \ No newline at end of file diff --git a/public/resources/js/controllers/app-controller.js b/public/resources/js/controllers/app-controller.js index 7ecbda9bbc..feb1d8613f 100644 --- a/public/resources/js/controllers/app-controller.js +++ b/public/resources/js/controllers/app-controller.js @@ -3,7 +3,7 @@ * */ -angularIO.controller('AppCtrl', ['$scope', '$mdDialog', function($scope, $mdDialog){ +angularIO.controller('AppCtrl', ['$scope', '$mdDialog', '$timeout', function($scope, $mdDialog, $timeout) { $scope.showDocsNav = false; $scope.showMainNav = false; @@ -27,6 +27,11 @@ angularIO.controller('AppCtrl', ['$scope', '$mdDialog', function($scope, $mdDial $scope.showMenu = !$scope.showMenu; }; - // INITIALIZE PRETTY PRINT - prettyPrint(); + /* + * Prettify Code + * + * Finish Rendereding code directives then prettify code + */ + + $timeout(prettyPrint, 1); }]); \ No newline at end of file diff --git a/public/resources/js/directives/code-example.js b/public/resources/js/directives/code-example.js index 06e7811787..597fa24f55 100644 --- a/public/resources/js/directives/code-example.js +++ b/public/resources/js/directives/code-example.js @@ -8,21 +8,22 @@ angularIO.directive('codeExample', function() { return { restrict: 'E', - transclude: true, - replace: true, - scope: { - name: '@', - language: '@', - format: '@' - }, - link: function(scope, element, attrs, codeSwitchController, transcludeFunc) { - transcludeFunc( scope, function( content ) { - var code = '' + content[0].innerHTML + ''; - element.append(code); - }); - }, + compile: function(tElement, tAttrs) { + var html = (tAttrs.escape === "html") ? _.escape(tElement.html()) : tElement.html(); + var template = '
' +
+                      '' + html + '' +
+                      '
'; - template:'
'
+      // UPDATE ELEMENT WITH NEW TEMPLATE
+      tElement.html(template);
+
+      // RETURN ELEMENT
+      return function(scope, element, attrs) {
+        // SET SCOPE MANUALLY
+        scope.language = attrs.language;
+        scope.format = attrs.format;
+      };
+    }
   };
 });
\ No newline at end of file
diff --git a/public/resources/js/directives/code-pane.js b/public/resources/js/directives/code-pane.js
index 89e53005c5..32655d09f7 100644
--- a/public/resources/js/directives/code-pane.js
+++ b/public/resources/js/directives/code-pane.js
@@ -11,23 +11,29 @@ angularIO.directive('codePane', function() {
   return {
     require: '^codeTabs',
     restrict: 'E',
-    transclude: true,
-    replace: true,
-    scope: {
-      name: '@',
-      language: '@',
-      format: '@'
-    },
+    scope: true,
 
-    link: function(scope, element, attrs, codeTabController, transcludeFunc) {
-      transcludeFunc( scope, function( content ) {
-        var code = '' + content[0].innerHTML + '';
-        element.append(code);
-      });
+    compile: function(tElement, tAttrs) {
+      var html = (tAttrs.escape === "html") ? _.escape(tElement.html()) : tElement.html();
+      var template =  '
' +
+                      '' + html + '' +
+                      '
'; - codeTabController.addPane(scope); - }, - template:'
'
+      // UPDATE ELEMENT WITH NEW TEMPLATE
+      tElement.html(template);
+
+
+      // RETURN LINK METHOD
+      return function(scope, element, attrs, controller) {
+        // SET SCOPE MANUALLY
+        scope.language = attrs.language;
+        scope.name = attrs.name;
+        scope.format = attrs.format;
+
+        //ADD PANE TO CONTROLLER
+        controller.addPane(scope);
+      };
+    }
   };
 });
\ No newline at end of file
diff --git a/public/resources/js/directives/code-tabs.js b/public/resources/js/directives/code-tabs.js
index bd309cb3c6..316470b015 100644
--- a/public/resources/js/directives/code-tabs.js
+++ b/public/resources/js/directives/code-tabs.js
@@ -44,16 +44,6 @@ angularIO.directive('codeTabs', function($timeout) {
         // SELECT CURRENT EXAMPLE
         pane.selected = true;
       };
-
-
-      /*
-      * Finish Rendereding then prettify code
-      *
-      */
-
-      $scope.$watch($scope.panes.$last,function(){
-        $timeout(prettyPrint, 1);
-      });
     },
 
     template:
diff --git a/public/resources/js/site.js b/public/resources/js/site.js
index 6306072d0b..335c0f66b9 100644
--- a/public/resources/js/site.js
+++ b/public/resources/js/site.js
@@ -3,7 +3,7 @@
 *
 */
 
-var angularIO = angular.module('angularIOApp', ['ngMaterial', 'ngTouch'])
+var angularIO = angular.module('angularIOApp', ['ngMaterial'])
 .config(function($mdThemingProvider) {
 
   // THEMEING FOR ANGULAR MATERIAL
diff --git a/public/resources/js/vendor/lodash.js b/public/resources/js/vendor/lodash.js
new file mode 100644
index 0000000000..4f4fc58176
--- /dev/null
+++ b/public/resources/js/vendor/lodash.js
@@ -0,0 +1,142 @@
+/**
+ * @license
+ * lodash 3.8.0 (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
+ * Build: `lodash compat -o ./lodash.js`
+ */
+;(function(){function n(n,t){if(n!==t){var r=n===n,e=t===t;if(n>t||!r||n===w&&e)return 1;if(n=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n);
+
+}function v(n,t){for(var r=-1,e=n.length,u=-1,o=[];++ri(t,f,0)&&u.push(f);return u}function lt(n,t){var r=true;return qu(n,function(n,e,u){return r=!!t(n,e,u)}),r}function st(n,t){var r=[];return qu(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function pt(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0;
+
+}),u}function ht(n,t,r){for(var e=-1,u=n.length,o=-1,i=[];++et&&(t=-t>u?0:u+t),r=r===w||r>u?u:+r||0,
+0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Ne(u);++eu(f,s,0)&&((t||a)&&f.push(s),c.push(l))}return c}function Nt(n,t){for(var r=-1,e=t.length,u=Ne(e);++r>>1,i=n[o];(r?i<=t:iu?null:o,u=1);++earguments.length;return typeof e=="function"&&o===w&&Lo(r)?n(r,e,u,i):Rt(r,wr(e,o,4),u,i,t)}}function sr(n,t,r,e,u,o,i,a,f,c){function l(){for(var b=arguments.length,j=b,O=Ne(b);j--;)O[j]=arguments[j];if(e&&(O=Dt(O,e,u)),o&&(O=qt(O,o,i)),_||y){var j=l.placeholder,E=v(O,j),b=b-E.length;if(bu)||i===e&&i===o)&&(u=i,o=n)}),o}function wr(n,t,r){var e=Ln.callback||Re,e=e===Re?it:e;return r?e(n,t,r):e}function br(n,t,e){var u=Ln.indexOf||qr,u=u===qr?r:u;return n?u(n,t,e):u}function xr(n){var t=n.length,r=new n.constructor(t);
+
+return t&&"string"==typeof n[0]&&He.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function Ar(n){return n=n.constructor,typeof n=="function"&&n instanceof n||(n=Me),new n}function jr(n,t,r){var e=n.constructor;switch(t){case J:return Mt(n);case M:case D:return new e(+n);case X:case H:case Q:case nn:case tn:case rn:case en:case un:case on:return e instanceof e&&(e=Pu[t]),t=n.buffer,new e(r?Mt(t):t,n.byteOffset,n.length);case V:case G:return new e(n);case Z:var u=new e(n.source,On.exec(n));u.lastIndex=n.lastIndex;
+
+}return u}function Or(n,t,r){return null==n||Rr(t,n)||(t=Pr(t),n=1==t.length?n:dt(n,St(t,0,-1)),t=Kr(t)),t=null==n?n:n[t],null==t?w:t.apply(n,r)}function Er(n){return null!=n&&Cr(Hu(n))}function kr(n,t){return n=+n,t=null==t?Nu:t,-1t?0:t)):[]}function Mr(n,t,r){var e=n?n.length:0;return e?((r?Ir(n,t,r):null==t)&&(t=1),t=e-(+t||0),St(n,0,0>t?0:t)):[]}function Dr(n){return n?n[0]:w}function qr(n,t,e){var u=n?n.length:0;
+
+if(!u)return-1;if(typeof e=="number")e=0>e?ju(u+e,0):e;else if(e)return e=Pt(n,t),n=n[e],(t===t?t===n:n!==n)?e:-1;return r(n,t,e||0)}function Kr(n){var t=n?n.length:0;return t?n[t-1]:w}function Vr(n){return Br(n,1)}function Yr(n,t,e,u){if(!n||!n.length)return[];null!=t&&typeof t!="boolean"&&(u=e,e=Ir(n,t,u)?null:t,t=false);var o=wr();if((o!==it||null!=e)&&(e=o(e,u,3)),t&&br()==r){t=e;var i;e=-1,u=n.length;for(var o=-1,a=[];++er?ju(u+r,0):r||0,typeof n=="string"||!Lo(n)&&ye(n)?rt?0:+t||0,n.length),n)}function ue(n){n=$r(n);for(var t=-1,r=n.length,e=Ne(r);++t=n&&(t=null),r}}function ae(n,t,r){
+function e(){var r=t-(Oo()-c);0>=r||r>t?(a&&iu(a),r=p,a=s=p=w,r&&(h=Oo(),f=n.apply(l,i),s||a||(i=l=null))):s=_u(e,r)}function u(){s&&iu(s),a=s=p=w,(v||_!==t)&&(h=Oo(),f=n.apply(l,i),s||a||(i=l=null))}function o(){if(i=arguments,c=Oo(),l=this,p=v&&(s||!g),false===_)var r=g&&!s;else{a||g||(h=c);var o=_-(c-h),y=0>=o||o>_;y?(a&&(a=iu(a)),h=c,f=n.apply(l,i)):a||(a=_u(u,o))}return y&&s?s=iu(s):s||t===_||(s=_u(e,t)),r&&(y=true,f=n.apply(l,i)),!y||s||a||(i=l=null),f}var i,a,f,c,l,s,p,h=0,_=false,v=true;if(typeof n!="function")throw new Ke(L);
+
+if(t=0>t?0:+t||0,true===r)var g=true,v=false;else he(r)&&(g=r.leading,_="maxWait"in r&&ju(+r.maxWait||0,t),v="trailing"in r?r.trailing:v);return o.cancel=function(){s&&iu(s),a&&iu(a),a=s=p=w},o}function fe(n,t){function r(){var e=arguments,u=r.cache,o=t?t.apply(this,e):e[0];return u.has(o)?u.get(o):(e=n.apply(this,e),u.set(o,e),e)}if(typeof n!="function"||t&&typeof t!="function")throw new Ke(L);return r.cache=new fe.Cache,r}function ce(n,t){if(typeof n!="function")throw new Ke(L);return t=ju(t===w?n.length-1:+t||0,0),
+function(){for(var r=arguments,e=-1,u=ju(r.length-t,0),o=Ne(u);++et||!n||!xu(t))return r;do t%2&&(r+=n),t=au(t/2),n+=n;while(t);return r}function ke(n,t,r){var e=n;return(n=u(n))?(r?Ir(e,t,r):null==t)?n.slice(g(n),y(n)+1):(t+="",n.slice(i(n,t),a(n,t)+1)):n}function Ie(n,t,r){return r&&Ir(n,t,r)&&(t=null),n=u(n),n.match(t||Cn)||[]}function Re(n,t,r){return r&&Ir(n,t,r)&&(t=null),h(n)?Te(n):it(n,t)}function Se(n){return function(){return n}}function Ce(n){return n}function Te(n){return xt(at(n,true))}function Ue(n,t,r){
+if(null==r){var e=he(t),u=e&&Jo(t);((u=u&&u.length&&yt(t,u))?u.length:e)||(u=false,r=t,t=n,n=this)}u||(u=yt(t,Jo(t)));var o=true,e=-1,i=zo(n),a=u.length;false===r?o=false:he(r)&&"chain"in r&&(o=r.chain);for(;++e>>1,Fu=du?du.BYTES_PER_ELEMENT:0,Nu=ze.pow(2,53)-1,$u=yu&&new yu,Lu={},Pu={};
+
+Pu[X]=_.Float32Array,Pu[H]=_.Float64Array,Pu[Q]=_.Int8Array,Pu[nn]=_.Int16Array,Pu[tn]=_.Int32Array,Pu[rn]=_.Uint8Array,Pu[en]=_.Uint8ClampedArray,Pu[un]=_.Uint16Array,Pu[on]=_.Uint32Array;var zu={};zu[B]=zu[D]=zu[V]={constructor:true,toLocaleString:true,toString:true,valueOf:true},zu[M]=zu[G]={constructor:true,toString:true,valueOf:true},zu[q]=zu[K]=zu[Z]={constructor:true,toString:true},zu[Y]={constructor:true},Vn(Wn,function(n){for(var t in zu)if(He.call(zu,t)){var r=zu[t];r[n]=He.call(r,n)}});var Bu=Ln.support={};
+
+!function(n){function t(){this.x=n}var r=arguments,e={0:n,length:n},u=[];t.prototype={valueOf:n,y:n};for(var o in new t)u.push(o);Bu.argsTag=nu.call(r)==z,Bu.enumErrorProps=pu.call(Ye,"message")||pu.call(Ye,"name"),Bu.enumPrototypes=pu.call(t,"prototype"),Bu.funcDecomp=/\bthis\b/.test(function(){return this}),Bu.funcNames=typeof Pe.name=="string",Bu.nodeTag=nu.call(Je)!=Y,Bu.nonEnumStrings=!pu.call("x",0),Bu.nonEnumShadows=!/valueOf/.test(u),Bu.ownLast="x"!=u[0],Bu.spliceObjects=(vu.call(e,0,1),!e[0]),
+Bu.unindexedChars="xx"!="x"[0]+Me("x")[0];try{Bu.dom=11===Je.createDocumentFragment().nodeType}catch(i){Bu.dom=false}try{Bu.nonEnumArgs=!pu.call(r,1)}catch(a){Bu.nonEnumArgs=true}}(1,0),Ln.templateSettings={escape:_n,evaluate:vn,interpolate:gn,variable:"",imports:{_:Ln}};var Mu=mu||function(n,t){return null==t?n:ot(t,Qu(t),ot(t,Jo(t),n))},Du=function(){function n(){}return function(t){if(he(t)){n.prototype=t;var r=new n;n.prototype=null}return r||_.Object()}}(),qu=Yt(vt),Ku=Yt(gt,true),Vu=Zt(),Yu=Zt(true),Zu=$u?function(n,t){
+return $u.set(n,t),n}:Ce;uu||(Mt=eu&&gu?function(n){var t=n.byteLength,r=du?au(t/Fu):0,e=r*Fu,u=new eu(t);if(r){var o=new du(u,0,r);o.set(new du(n,0,r))}return t!=e&&(o=new gu(u,e),o.set(new gu(n,e))),u}:Se(null));var Gu=bu&&hu?function(n){return new Dn(n)}:Se(null),Ju=$u?function(n){return $u.get(n)}:We,Xu=function(){return Bu.funcNames?"constant"==Se.name?Ot("name"):function(n){for(var t=n.name,r=Lu[t],e=r?r.length:0;e--;){var u=r[e],o=u.func;if(null==o||o==n)return u.name}return t}:Se("")}(),Hu=Ot("length"),Qu=fu?function(n){
+return fu(Lr(n))}:Se([]),no=function(){var n=0,t=0;return function(r,e){var u=Oo(),o=W-(u-t);if(t=u,0=U)return r}else n=0;return Zu(r,e)}}(),to=ce(function(n,t){return Er(n)?ct(n,ht(t,false,true)):[]}),ro=tr(),eo=tr(true),uo=ce(function(t,r){r=ht(r);var e=ut(t,r);return kt(t,r.sort(n)),e}),oo=_r(),io=_r(true),ao=ce(function(n){return Ft(ht(n,false,true))}),fo=ce(function(n,t){return Er(n)?ct(n,t):[]}),co=ce(Zr),lo=ce(function(n){var t=n.length,r=n[t-2],e=n[t-1];return 2e&&(e=u)}return e}),pi=Qt(function(n){for(var t=-1,r=n.length,e=Cu;++t--n?t.apply(this,arguments):void 0}},Ln.ary=function(n,t,r){
+return r&&Ir(n,t,r)&&(t=null),t=n&&null==t?n.length:ju(+t||0,0),vr(n,R,null,null,null,null,t)},Ln.assign=Mo,Ln.at=so,Ln.before=ie,Ln.bind=Eo,Ln.bindAll=ko,Ln.bindKey=Io,Ln.callback=Re,Ln.chain=Xr,Ln.chunk=function(n,t,r){t=(r?Ir(n,t,r):null==t)?1:ju(+t||1,1),r=0;for(var e=n?n.length:0,u=-1,o=Ne(ou(e/t));rr&&(r=-r>u?0:u+r),e=e===w||e>u?u:+e||0,0>e&&(e+=u),
+u=r>e?0:e>>>0,r>>>=0;re)return a;var i=n[0],c=-1,l=i?i.length:0,s=u[0];n:for(;++c(s?qn(s,f):o(a,f,0))){for(t=e;--t;){var p=u[t];if(0>(p?qn(p,f):o(n[t],f,0)))continue n}s&&s.push(f),a.push(f)}return a},Ln.invert=function(n,t,r){r&&Ir(n,t,r)&&(t=null),r=-1;for(var e=Jo(n),u=e.length,o={};++rt?0:t)):[]},Ln.takeRight=function(n,t,r){var e=n?n.length:0;return e?((r?Ir(n,t,r):null==t)&&(t=1),t=e-(+t||0),St(n,0>t?0:t)):[]},Ln.takeRightWhile=function(n,t,r){return n&&n.length?$t(n,wr(t,r,3),false,true):[]},Ln.takeWhile=function(n,t,r){return n&&n.length?$t(n,wr(t,r,3)):[]},Ln.tap=function(n,t,r){return t.call(r,n),n},Ln.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new Ke(L);
+
+return false===r?e=false:he(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),$n.leading=e,$n.maxWait=+t,$n.trailing=u,ae(n,t,$n)},Ln.thru=Hr,Ln.times=function(n,t,r){if(n=au(n),1>n||!xu(n))return[];var e=-1,u=Ne(Ou(n,Tu));for(t=Bt(t,r,1);++er?0:+r||0,e),r-=t.length,0<=r&&n.indexOf(t,r)==r},Ln.escape=function(n){return(n=u(n))&&hn.test(n)?n.replace(sn,l):n},Ln.escapeRegExp=je,Ln.every=Qr,Ln.find=ho,Ln.findIndex=ro,Ln.findKey=qo,Ln.findLast=_o,Ln.findLastIndex=eo,Ln.findLastKey=Ko,Ln.findWhere=function(n,t){return ho(n,xt(t))},Ln.first=Dr,Ln.get=function(n,t,r){return n=null==n?w:dt(n,Pr(t),t+""),
+n===w?r:n},Ln.has=function(n,t){if(null==n)return false;var r=He.call(n,t);return r||Rr(t)||(t=Pr(t),n=1==t.length?n:dt(n,St(t,0,-1)),t=Kr(t),r=null!=n&&He.call(n,t)),r||Ln.support.nonEnumStrings&&ye(n)&&kr(t,n.length)},Ln.identity=Ce,Ln.includes=te,Ln.indexOf=qr,Ln.inRange=function(n,t,r){return t=+t||0,"undefined"===typeof r?(r=t,t=0):r=+r||0,n>=Ou(t,r)&&nr?ju(e+r,0):Ou(r||0,e-1))+1;else if(r)return u=Pt(n,t,true)-1,
+n=n[u],(t===t?t===n:n!==n)?u:-1;if(t!==t)return p(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Ln.max=si,Ln.min=pi,Ln.noConflict=function(){return _._=tu,this},Ln.noop=We,Ln.now=Oo,Ln.pad=function(n,t,r){n=u(n),t=+t;var e=n.length;return er?0:+r||0,n.length),n.lastIndexOf(t,r)==r},Ln.sum=function(n,t,r){r&&Ir(n,t,r)&&(t=null);var e=wr(),u=null==t;if(e===it&&u||(u=false,t=e(t,r,3)),u){for(n=Lo(n)?n:$r(n),t=n.length,r=0;t--;)r+=+n[t]||0;n=r}else n=Wt(n,t);return n},Ln.template=function(n,t,r){var e=Ln.templateSettings;r&&Ir(n,t,r)&&(t=r=null),n=u(n),t=et(Mu({},r||t),e,rt),r=et(Mu({},t.imports),e.imports,rt);var o,i,a=Jo(r),f=Nt(r,a),c=0;r=t.interpolate||Rn;var l="__p+='";
+
+r=De((t.escape||Rn).source+"|"+r.source+"|"+(r===gn?jn:Rn).source+"|"+(t.evaluate||Rn).source+"|$","g");var p="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,u,a,f){return e||(e=u),l+=n.slice(c,f).replace(Sn,s),r&&(o=true,l+="'+__e("+r+")+'"),a&&(i=true,l+="';"+a+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),c=f+t.length,t}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(i?l.replace(an,""):l).replace(fn,"$1").replace(cn,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(o?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",
+t=fi(function(){return Pe(a,p+"return "+l).apply(w,f)}),t.source=l,pe(t))throw t;return t},Ln.trim=ke,Ln.trimLeft=function(n,t,r){var e=n;return(n=u(n))?n.slice((r?Ir(e,t,r):null==t)?g(n):i(n,t+"")):n},Ln.trimRight=function(n,t,r){var e=n;return(n=u(n))?(r?Ir(e,t,r):null==t)?n.slice(0,y(n)+1):n.slice(0,a(n,t+"")+1):n},Ln.trunc=function(n,t,r){r&&Ir(n,t,r)&&(t=null);var e=C;if(r=T,null!=t)if(he(t)){var o="separator"in t?t.separator:o,e="length"in t?+t.length||0:e;r="omission"in t?u(t.omission):r}else e=+t||0;
+
+if(n=u(n),e>=n.length)return n;if(e-=r.length,1>e)return r;if(t=n.slice(0,e),null==o)return t+r;if(ge(o)){if(n.slice(e).search(o)){var i,a=n.slice(0,e);for(o.global||(o=De(o.source,(On.exec(o)||"")+"g")),o.lastIndex=0;n=o.exec(a);)i=n.index;t=t.slice(0,null==i?e:i)}}else n.indexOf(o,e)!=e&&(o=t.lastIndexOf(o),-1u.__dir__?"Right":"")
+}),u},Bn.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},Bn.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[r](n,t).reverse()}}),Vn(["first","last"],function(n,t){var r="take"+(t?"Right":"");Bn.prototype[n]=function(){return this[r](1).value()[0]}}),Vn(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");Bn.prototype[n]=function(){return this[r](1)}}),Vn(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?xt:Fe;Bn.prototype[n]=function(n){return this[r](e(n));
+
+}}),Bn.prototype.compact=function(){return this.filter(Ce)},Bn.prototype.reject=function(n,t){return n=wr(n,t,1),this.filter(function(t){return!n(t)})},Bn.prototype.slice=function(n,t){n=null==n?0:+n||0;var r=this;return 0>n?r=this.takeRight(-n):n&&(r=this.drop(n)),t!==w&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},Bn.prototype.toArray=function(){return this.drop(0)},vt(Bn.prototype,function(n,t){var r=Ln[t];if(r){var e=/^(?:filter|map|reject)|While$/.test(t),u=/^(?:first|last)$/.test(t);Ln.prototype[t]=function(){
+function t(n){return n=[n],lu.apply(n,o),r.apply(Ln,n)}var o=arguments,i=this.__chain__,a=this.__wrapped__,f=!!this.__actions__.length,c=a instanceof Bn,l=o[0],s=c||Lo(a);return s&&e&&typeof l=="function"&&1!=l.length&&(c=s=false),c=c&&!f,u&&!i?c?n.call(a):r.call(Ln,this.value()):s?(a=n.apply(c?a:new Bn(this),o),u||!f&&!a.__actions__||(a.__actions__||(a.__actions__=[])).push({func:Hr,args:[t],thisArg:Ln}),new zn(a,i)):this.thru(t)}}}),Vn("concat join pop push replace shift sort splice split unshift".split(" "),function(n){
+var t=(/^(?:replace|split)$/.test(n)?Ge:Ve)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|replace|shift)$/.test(n),u=Bu.spliceObjects||!/^(?:pop|shift|splice)$/.test(n)?t:function(){var n=t.apply(this,arguments);return 0===this.length&&delete this[0],n};Ln.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?u.apply(this.value(),n):this[r](function(t){return u.apply(t,n)})}}),vt(Bn.prototype,function(n,t){var r=Ln[t];if(r){var e=r.name;(Lu[e]||(Lu[e]=[])).push({
+name:t,func:r})}}),Lu[sr(null,A).name]=[{name:"wrapper",func:null}],Bn.prototype.clone=function(){var n=this.__actions__,t=this.__iteratees__,r=this.__views__,e=new Bn(this.__wrapped__);return e.__actions__=n?Kn(n):null,e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=t?Kn(t):null,e.__takeCount__=this.__takeCount__,e.__views__=r?Kn(r):null,e},Bn.prototype.reverse=function(){if(this.__filtered__){var n=new Bn(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;
+
+return n},Bn.prototype.value=function(){var n=this.__wrapped__.value();if(!Lo(n))return Lt(n,this.__actions__);var t,r=this.__dir__,e=0>r;t=n.length;for(var u=this.__views__,o=0,i=-1,a=u?u.length:0;++ip.index:u=_:!h(s))))continue n}else if(p=h(s),_==$)s=p;else if(!p){if(_==N)continue n;break n}}c[f++]=s}return c},Ln.prototype.chain=function(){return Xr(this)},Ln.prototype.commit=function(){return new zn(this.value(),this.__chain__)},Ln.prototype.plant=function(n){for(var t,r=this;r instanceof Pn;){var e=zr(r);t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__;
+
+}return u.__wrapped__=n,t},Ln.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Bn?(this.__actions__.length&&(n=new Bn(this)),new zn(n.reverse(),this.__chain__)):this.thru(function(n){return n.reverse()})},Ln.prototype.toString=function(){return this.value()+""},Ln.prototype.run=Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return Lt(this.__wrapped__,this.__actions__)},Ln.prototype.collect=Ln.prototype.map,Ln.prototype.head=Ln.prototype.first,Ln.prototype.select=Ln.prototype.filter,
+Ln.prototype.tail=Ln.prototype.rest,Ln}var w,b="3.8.0",x=1,A=2,j=4,O=8,E=16,k=32,I=64,R=128,S=256,C=30,T="...",U=150,W=16,F=0,N=1,$=2,L="Expected a function",P="__lodash_placeholder__",z="[object Arguments]",B="[object Array]",M="[object Boolean]",D="[object Date]",q="[object Error]",K="[object Function]",V="[object Number]",Y="[object Object]",Z="[object RegExp]",G="[object String]",J="[object ArrayBuffer]",X="[object Float32Array]",H="[object Float64Array]",Q="[object Int8Array]",nn="[object Int16Array]",tn="[object Int32Array]",rn="[object Uint8Array]",en="[object Uint8ClampedArray]",un="[object Uint16Array]",on="[object Uint32Array]",an=/\b__p\+='';/g,fn=/\b(__p\+=)''\+/g,cn=/(__e\(.*?\)|\b__t\))\+'';/g,ln=/&(?:amp|lt|gt|quot|#39|#96);/g,sn=/[&<>"'`]/g,pn=RegExp(ln.source),hn=RegExp(sn.source),_n=/<%-([\s\S]+?)%>/g,vn=/<%([\s\S]+?)%>/g,gn=/<%=([\s\S]+?)%>/g,yn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,dn=/^\w*$/,mn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,wn=/[.*+?^${}()|[\]\/\\]/g,bn=RegExp(wn.source),xn=/[\u0300-\u036f\ufe20-\ufe23]/g,An=/\\(\\)?/g,jn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,On=/\w*$/,En=/^0[xX]/,kn=/^\[object .+?Constructor\]$/,In=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Rn=/($^)/,Sn=/['\n\r\u2028\u2029\\]/g,Cn=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),Tn=" \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",Un="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window".split(" "),Wn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),Fn={};
+
+Fn[X]=Fn[H]=Fn[Q]=Fn[nn]=Fn[tn]=Fn[rn]=Fn[en]=Fn[un]=Fn[on]=true,Fn[z]=Fn[B]=Fn[J]=Fn[M]=Fn[D]=Fn[q]=Fn[K]=Fn["[object Map]"]=Fn[V]=Fn[Y]=Fn[Z]=Fn["[object Set]"]=Fn[G]=Fn["[object WeakMap]"]=false;var Nn={};Nn[z]=Nn[B]=Nn[J]=Nn[M]=Nn[D]=Nn[X]=Nn[H]=Nn[Q]=Nn[nn]=Nn[tn]=Nn[V]=Nn[Y]=Nn[Z]=Nn[G]=Nn[rn]=Nn[en]=Nn[un]=Nn[on]=true,Nn[q]=Nn[K]=Nn["[object Map]"]=Nn["[object Set]"]=Nn["[object WeakMap]"]=false;var $n={leading:false,maxWait:0,trailing:false},Ln={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A",
+"\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u",
+"\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Pn={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},zn={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Bn={"function":true,object:true},Mn={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Dn=Bn[typeof exports]&&exports&&!exports.nodeType&&exports,qn=Bn[typeof module]&&module&&!module.nodeType&&module,Kn=Bn[typeof self]&&self&&self.Object&&self,Vn=Bn[typeof window]&&window&&window.Object&&window,Yn=qn&&qn.exports===Dn&&Dn,Zn=Dn&&qn&&typeof global=="object"&&global&&global.Object&&global||Vn!==(this&&this.window)&&Vn||Kn||this,Gn=function(){
+try{Object({toString:0}+"")}catch(n){return function(){return false}}return function(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}}(),Jn=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Zn._=Jn, define(function(){return Jn})):Dn&&qn?Yn?(qn.exports=Jn)._=Jn:Dn._=Jn:Zn._=Jn}).call(this);
\ No newline at end of file

From 3b08583342c731958651b25f373dd6b16cd72258 Mon Sep 17 00:00:00 2001
From: Alex Wolfe 
Date: Sun, 3 May 2015 19:10:10 -0700
Subject: [PATCH 06/13] spacing

---
 public/resources/js/controllers/app-controller.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/public/resources/js/controllers/app-controller.js b/public/resources/js/controllers/app-controller.js
index feb1d8613f..350be7ec82 100644
--- a/public/resources/js/controllers/app-controller.js
+++ b/public/resources/js/controllers/app-controller.js
@@ -4,7 +4,6 @@
 */
 
 angularIO.controller('AppCtrl', ['$scope', '$mdDialog', '$timeout', function($scope, $mdDialog, $timeout) {
-
   $scope.showDocsNav = false;
   $scope.showMainNav = false;
   $scope.showMenu = false;
@@ -27,6 +26,7 @@ angularIO.controller('AppCtrl', ['$scope', '$mdDialog', '$timeout', function($sc
     $scope.showMenu = !$scope.showMenu;
   };
 
+
   /*
   * Prettify Code
   *

From 4210541f2462e740b832a239fc706747c737c4ca Mon Sep 17 00:00:00 2001
From: Alex Wolfe 
Date: Sun, 3 May 2015 20:28:21 -0700
Subject: [PATCH 07/13] use one layout, update logic, add prettify to api code
 tags

---
 public/_includes/_next-item.jade                |  4 +---
 public/docs/_layout.jade                        | 13 +++++++++++--
 public/docs/dart/latest/guide/_layout.jade      | 17 -----------------
 public/docs/js/latest/guide/_layout.jade        | 17 -----------------
 .../resources/js/controllers/app-controller.js  | 14 ++++++++++++++
 5 files changed, 26 insertions(+), 39 deletions(-)
 delete mode 100644 public/docs/dart/latest/guide/_layout.jade
 delete mode 100644 public/docs/js/latest/guide/_layout.jade

diff --git a/public/_includes/_next-item.jade b/public/_includes/_next-item.jade
index 8fd337e78a..65cbca6217 100644
--- a/public/_includes/_next-item.jade
+++ b/public/_includes/_next-item.jade
@@ -17,6 +17,4 @@ for page, slug in data
 
     // SET CURRENT PAGE FLAG WHEN YOU PASS IT
     if current.path[4] == slug
-      currentPage = true
-
-
+      currentPage = true
\ No newline at end of file
diff --git a/public/docs/_layout.jade b/public/docs/_layout.jade
index 9d907fe3e6..b533ba9736 100644
--- a/public/docs/_layout.jade
+++ b/public/docs/_layout.jade
@@ -9,8 +9,17 @@ html(lang="en" ng-app="angularIOApp")
     != partial("../_includes/_hero")
     != partial("../_includes/_banner")
 
-    article.l-content-small.grid-fluid.docs-content
-      != yield
+
+    if current.path[3] == 'api'
+      article(class="l-content-small grid-fluid docs-content" ng-non-bindable)
+        != yield
+
+    else
+      article(class="l-content-small grid-fluid docs-content")
+        != yield
+
+        if current.path[3] == 'guide' && current.path[4]
+          != 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/_layout.jade b/public/docs/dart/latest/guide/_layout.jade
deleted file mode 100644
index ed495fbb37..0000000000
--- a/public/docs/dart/latest/guide/_layout.jade
+++ /dev/null
@@ -1,17 +0,0 @@
-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/sidenav/_primary")
-    != partial("../../../../_includes/_hero")
-    != 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/js/latest/guide/_layout.jade b/public/docs/js/latest/guide/_layout.jade
deleted file mode 100644
index 35040681c8..0000000000
--- a/public/docs/js/latest/guide/_layout.jade
+++ /dev/null
@@ -1,17 +0,0 @@
-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/sidenav/_primary")
-    != partial("../../../../_includes/_hero")
-    != partial("../../../../_includes/_banner")
-
-    article.l-content-small.grid-fluid.docs-content
-      != yield
-      != partial("../../../../_includes/_next-item")
-
-    != partial("../../../../_includes/_footer")
-    != partial("../../../../_includes/_scripts-include")
diff --git a/public/resources/js/controllers/app-controller.js b/public/resources/js/controllers/app-controller.js
index 350be7ec82..a853855a08 100644
--- a/public/resources/js/controllers/app-controller.js
+++ b/public/resources/js/controllers/app-controller.js
@@ -33,5 +33,19 @@ angularIO.controller('AppCtrl', ['$scope', '$mdDialog', '$timeout', function($sc
   * Finish Rendereding code directives then prettify code
   */
 
+  // GRAB ALL TAGS NOT USING DIRECTIVES
+  var preTags = angular.element(document.body).find('pre');
+
+  // LOOP THROUGH AND ADD PRETTIFY CLASS
+  _.each(preTags, function(element) {
+    var preTag = angular.element(element);
+
+    // IF NOT FORMATTED, ADD PRETTY PRINT
+    if(!preTag.hasClass('prettyprint')) {
+      preTag.addClass('prettyprint linums');
+    }
+  });
+
+  // TRIGGER PRETTYPRINT AFTER DIGEST LOOP COMPLETE
   $timeout(prettyPrint, 1);
 }]);
\ No newline at end of file

From 0d27464c7aa83b3dfe29760c7b673dc5e2435165 Mon Sep 17 00:00:00 2001
From: Alex Wolfe 
Date: Sun, 3 May 2015 20:29:54 -0700
Subject: [PATCH 08/13] linenums

---
 public/resources/js/controllers/app-controller.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/public/resources/js/controllers/app-controller.js b/public/resources/js/controllers/app-controller.js
index a853855a08..484f9a4716 100644
--- a/public/resources/js/controllers/app-controller.js
+++ b/public/resources/js/controllers/app-controller.js
@@ -42,7 +42,7 @@ angularIO.controller('AppCtrl', ['$scope', '$mdDialog', '$timeout', function($sc
 
     // IF NOT FORMATTED, ADD PRETTY PRINT
     if(!preTag.hasClass('prettyprint')) {
-      preTag.addClass('prettyprint linums');
+      preTag.addClass('prettyprint linenums');
     }
   });
 

From a85af9e15e4e70d9fc73812e2f833064ab71e3e4 Mon Sep 17 00:00:00 2001
From: Alex Wolfe 
Date: Tue, 5 May 2015 09:56:18 -0700
Subject: [PATCH 09/13] Update bio card directive, code cleanup

---
 public/about/index.jade                       |   2 +-
 .../docs/js/latest/guide/displaying-data.jade | 196 +++++++++---------
 .../js/controllers/app-controller.js          |   9 +-
 public/resources/js/directives/bio.js         |  45 ++--
 4 files changed, 122 insertions(+), 130 deletions(-)

diff --git a/public/about/index.jade b/public/about/index.jade
index 35a4c015ac..a32b23b5ae 100644
--- a/public/about/index.jade
+++ b/public/about/index.jade
@@ -19,7 +19,7 @@
   
   for person, name in bios
     .c3
-      md-card(biocard class="bio-card" data-website="#{person.website}" data-twitter="#{person.twitter}" data-pic="#{person.picture}" data-bio="#{person.bio}"  data-name="#{person.name}")
+      md-card(biocard class="bio-card" website="#{person.website}" twitter="#{person.twitter}" pic="#{person.picture}" bio="#{person.bio}"  name="#{person.name}")
         header
           image(src="#{person.picture}" alt="#person.name")
 
diff --git a/public/docs/js/latest/guide/displaying-data.jade b/public/docs/js/latest/guide/displaying-data.jade
index f5f96ad765..fb0f702764 100644
--- a/public/docs/js/latest/guide/displaying-data.jade
+++ b/public/docs/js/latest/guide/displaying-data.jade
@@ -19,9 +19,10 @@
     h2#section-create-an-entry-point Create an entry point
 
     p Open your favorite editor and create a show-properties.html file with the content:
-    pre.prettyprint.linenums.lang-html
-      code.
-         <display></display>
+
+    code-example(language="html" escape="html").
+      
+
     p
      | The <display> component here acts as the site where you'll insert your application.
      | We'll assume a structure like this for the rest of the examples here and just focus on the parts that
@@ -35,52 +36,48 @@
 
     p To see this working, create another file, show-properties.js, and add the following:
 
-    .code-box
-      pre.prettyprint.linenums.lang-javascript(data-name="es5")
-          code.
-            // ES5
-            function DisplayComponent() {
-              this.myName = "Alice";
-            }
-            DisplayComponent.annotations = [
-              new angular.Component({
-                selector: "display"
-              }),
-              new angular.View({
-                template:
-                   '<p>My name: {{ myName }}</p>',
-                directives: [angular.For, angular.If]
-              })
-            ];
+    code-tabs
+      code-pane(language="javascript" name="ES5" format="linenums" escape="html").
+        // ES5
+        function DisplayComponent() {
+          this.myName = "Alice";
+        }
+        DisplayComponent.annotations = [
+          new angular.Component({
+            selector: "display"
+          }),
+          new angular.View({
+            template:
+               

My name: {{ myName }}

, + directives: [angular.For, angular.If] + }) + ]; - pre.prettyprint.linenums.lang-typescript(data-name="typescript") - code. - // TypeScript - import {Component, View, bootstrap, For} from 'angular2/angular2'; + code-pane(language="javascript" name="TypeScript" format="linenums" escape="html"). + // TypeScript + import {Component, View, bootstrap, For} from 'angular2/angular2'; - @Component({ - selector: 'display' - }) - @View({ - template: ` - <p>My name: {{ myName }}</p> - `, - directives: [For] - }) - class DisplayComponent { - myName: string; - todos: Array<string>; + @Component({ + selector: 'display' + }) + @View({ + template: `<p>My name: {{ myName }}</p>`, + directives: [For] + }) + class DisplayComponent { + myName: string; + todos: Array<string> - constructor() { - this.myName = "Alice"; - } - } + constructor() { + this.myName = "Alice"; + } + } p. You've just defined a component that encompases a view and controller for the app. The view defines a template: - pre.prettyprint.lang-html - code. - <p>My name: {{ myName }}</p> + + code-example(language="html" escape="html"). +

My name: {{ myName }}

p. Angular will automatically pull the value of myName and insert it into the browser and @@ -98,16 +95,16 @@ just one property, myName. .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. + 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 So you can see Angular dynamically update content, add a line after - pre.prettyprint.lang-html - code. - <p>My name: {{ myName }}</p> + code-example(language="html" escape="html"). +

My name: {{ myName }}

+ p to this: pre.prettyprint.lang-html code. @@ -120,67 +117,66 @@ code. setInterval(function () { this.time = (new Date()).toString(); }.bind(this), 1000); p Reload the page in your browser and you'll now see the seconds updating automatically. + .l-main-section h2#Create-an-array Create an array property and use For on the view p Moving up from a single property, create an array to display as a list. - .code-box - pre.prettyprint.lang-javascript(data-name="es5") - code. - //ES5 - function DisplayComponent() { - this.myName = "Alice"; - this.names = ["Aarav", "Martín", "Shannon", "Ariana", "Kai"]; - } - pre.prettyprint.lang-typescript(data-name="typescript") - code. - //Typescript - constructor() { - this.myName = "Alice"; - this.names = ["Aarav", "Martín", "Shannon", "Ariana", "Kai"]; - } + + code-tabs + code-pane(language="javascript" name="ES5" format="linenums" escape="html"). + //ES5 + function DisplayComponent() { + this.myName = "Alice"; + this.names = ["Aarav", "Martín", "Shannon", "Ariana", "Kai"]; + } + code-pane(language="javascript" name="TypeScript" format="linenums" escape="html"). + //Typescript + constructor() { + this.myName = "Alice"; + this.names = ["Aarav", "Martín", "Shannon", "Ariana", "Kai"]; + } + p. You can then use this array in your template with the for directive to create copies of DOM elements with one for each item in the array. - .code-box - pre.prettyprint.lang-javascript(data-name="es5") - code. - //ES5 - template: - '<p>My name: {{ myName }}</p>' + - '<p>Friends:</p>' + - '<ul>' + - '<li *for="#name of names">' + - '{{ name }}' + - '</li>' + - '</ul>', - pre.prettyprint.lang-typescript(data-name="typescript") - code. - //Typescript - template: ` - <p>My name: {{ myName }}</p> - <p>Friends:</p> - <ul> - <li *for="#name of names"> - {{ name }} - </li> - </ul> - `, + code-tabs + code-pane(language="javascript" name="ES5" format="linenums"). + //ES5 + template: + '<p>My name: {{ myName }}</p>' + + '<p>Friends:</p>' + + '<ul>' + + '<li *for="#name of names">' + + '{{ name }}' + + '</li>' + + '</ul>', + code-pane(language="javascript" name="TypeScript" format="linenums"). + //Typescript + template: ` + <p>My name: {{ myName }}</p> + <p>Friends:</p> + <ul> + <li *for="#name of names"> + {{ name }} + </li> + </ul> + `, + p. To make this work, you'll also need to add the angular.For directive used by the template so that Angular knows to include it: - .code-box - pre.prettyprint.lang-javascript(data-name="es5") - code. - //ES5 - directives: [angular.For] - pre.prettyprint.lang-typescript(data-name="typescript") - code. - //Typescript - import {Component, View, bootstrap, For} from - ... - directives: [For] + code-tabs + code-pane(language="javascript" name="ES5" format="linenums"). + //ES5 + directives: [angular.For] + code-pane(language="javascript" name="TypeScript" format="linenums"). + //Typescript + import {Component, View, bootstrap, For} from + ... + directives: [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 diff --git a/public/resources/js/controllers/app-controller.js b/public/resources/js/controllers/app-controller.js index 484f9a4716..1a94ffb121 100644 --- a/public/resources/js/controllers/app-controller.js +++ b/public/resources/js/controllers/app-controller.js @@ -9,20 +9,17 @@ angularIO.controller('AppCtrl', ['$scope', '$mdDialog', '$timeout', function($sc $scope.showMenu = false; // TOGGLE MAIN NAV (TOP) ON MOBILE - $scope.toggleDocsMenu = function(event) { - event.preventDefault(); + $scope.toggleDocsMenu = function() { $scope.showDocsNav = !$scope.showDocsNav; }; // TOGGLE DOCS NAV - $scope.toggleMainMenu = function(event) { - event.preventDefault(); + $scope.toggleMainMenu = function() { $scope.showMainNav = !$scope.showMainNav; }; // TOGGLE DOCS VERSION & LANGUAGE - $scope.toggleVersionMenu = function(event) { - event.preventDefault(); + $scope.toggleVersionMenu = function() { $scope.showMenu = !$scope.showMenu; }; diff --git a/public/resources/js/directives/bio.js b/public/resources/js/directives/bio.js index 5ab54a1d2a..28f5daef19 100644 --- a/public/resources/js/directives/bio.js +++ b/public/resources/js/directives/bio.js @@ -3,45 +3,44 @@ angularIO.directive('biocard', function($rootScope, $timeout, $mdDialog) { restrict: 'A', scope: {}, link: function (scope, element, attrs) { - scope.name = element.attr('data-name'); - scope.bio = element.attr('data-bio'); - scope.pic = element.attr('data-pic'); - scope.twitter = element.attr('data-twitter'); - scope.website = element.attr('data-website'); - scope.$twitter = scope.twitter !== 'undefined' ? 'Twitter' : ''; - scope.$website = scope.website !== 'undefined' ? 'Website' : ''; + // SET SCOPE VALUES + scope.name = attrs.name; + scope.pic = attrs.pic; + scope.bio = attrs.bio; + scope.twitter = attrs.twitter; + scope.website = attrs.website; + // CLOSE MODAL METHOD + scope.closeDialog = function() { + $mdDialog.hide(); + }; + + // OPEN BIO WHEN CLICKING ON CARD element.on('click', function($event) { $mdDialog.show({ parent: angular.element(document.body), targetEvent: $event, + scope: scope, // use parent scope in template + preserveScope: true, template: '' + ' ' + - ' ' + - '

' + scope.name + '

' + - ' ' + - '

' + scope.bio + '

' + + ' ' + + '

{{name}}

' + + ' ' + + '

{{bio}}

' + '
' + '
' + ' ' + ' Close Bio' + ' ' + '
' + - '
', - locals: { - items: scope.items - }, - controller: DialogController + '' }); }); - - function DialogController(scope, $mdDialog, items) { - scope.items = items; - scope.closeDialog = function() { - $mdDialog.hide(); - }; - } } }; }); \ No newline at end of file From 799a16c5c51b6d4c9bfab901d07458b4e7320f70 Mon Sep 17 00:00:00 2001 From: Alex Wolfe Date: Mon, 18 May 2015 06:41:26 -0700 Subject: [PATCH 10/13] update to code examples --- .../_includes/styleguide/_code-examples.jade | 31 +++++++++++++------ .../resources/js/directives/code-example.js | 12 +++---- public/resources/js/directives/code-pane.js | 5 +-- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/public/docs/_includes/styleguide/_code-examples.jade b/public/docs/_includes/styleguide/_code-examples.jade index 0b3ffb3639..c9987f7739 100644 --- a/public/docs/_includes/styleguide/_code-examples.jade +++ b/public/docs/_includes/styleguide/_code-examples.jade @@ -3,21 +3,26 @@ h2 Code Examples p Below are some examples of how you can add/customize code examples in a page. + strong.l-space-top-3.l-space-bottom-1 ATTRIBUTES: + ul + li name Name displayed in Tab (required for tabs) + li language javascript, html, etc. + li escape html (escapes html, woot!) + li format linenums (or linenums:4 specify starting line) + .showcase-content .l-sub-section h3 Adding a code example - code-example(format="linenums"). - //SOME CODE - var name = "Alex Wolfe"; - alert(name); - + code-example(format="linenums" language="html"). + code-example(format="linenums" language="javascript"). + //SOME CODE .l-sub-section h3 Specify starting line number - code-example(language="html" format="linenums:4"). - var title = "This starts on line four"; - + code-example(language="javascript" format="linenums:4"). + code-example(language="html" format="linenums:4"). + var title = "This starts on line four"; .l-sub-section h3 Specify a language @@ -40,7 +45,7 @@ Black. You can see examples below and the class names needed for each type. - code-example(format="linenums" escape="html"). + code-example(format="linenums"). // Pink Background Version // class="pnk" var elephants = "The pink elephants were marching..."; @@ -68,3 +73,11 @@ code-pane(language="javascript" format="linenums" name="TypeScript"). // TypeScript var hello = 'blah'; + + p To create code tabs simply use the directives below + code-example(format="linenums"). + code-tabs + code-pane(format="linenums" name="Tab 1"). + // TAB 1 CONTENT + code-pane(format="linenums" name="Tab 2"). + // TAB 2 CONTENT \ No newline at end of file diff --git a/public/resources/js/directives/code-example.js b/public/resources/js/directives/code-example.js index 597fa24f55..d279203141 100644 --- a/public/resources/js/directives/code-example.js +++ b/public/resources/js/directives/code-example.js @@ -9,9 +9,9 @@ angularIO.directive('codeExample', function() { return { restrict: 'E', - compile: function(tElement, tAttrs) { - var html = (tAttrs.escape === "html") ? _.escape(tElement.html()) : tElement.html(); - var template = '
' +
+    compile: function(tElement, attrs) {
+      var html = (attrs.escape === "html") ? _.escape(tElement.html()) : tElement.html();
+      var template =  '
' +
                       '' + html + '' +
                       '
'; @@ -19,11 +19,7 @@ angularIO.directive('codeExample', function() { tElement.html(template); // RETURN ELEMENT - return function(scope, element, attrs) { - // SET SCOPE MANUALLY - scope.language = attrs.language; - scope.format = attrs.format; - }; + return function(scope, element, attrs) {}; } }; }); \ No newline at end of file diff --git a/public/resources/js/directives/code-pane.js b/public/resources/js/directives/code-pane.js index 32655d09f7..a91117225b 100644 --- a/public/resources/js/directives/code-pane.js +++ b/public/resources/js/directives/code-pane.js @@ -15,7 +15,7 @@ angularIO.directive('codePane', function() { compile: function(tElement, tAttrs) { var html = (tAttrs.escape === "html") ? _.escape(tElement.html()) : tElement.html(); - var template = '
' +
+      var template =  '
' +
                       '' + html + '' +
                       '
'; @@ -26,10 +26,7 @@ angularIO.directive('codePane', function() { // RETURN LINK METHOD return function(scope, element, attrs, controller) { - // SET SCOPE MANUALLY - scope.language = attrs.language; scope.name = attrs.name; - scope.format = attrs.format; //ADD PANE TO CONTROLLER controller.addPane(scope); From 8c65545cc83bd7fcc0f69c88bbbbce2862953a4e Mon Sep 17 00:00:00 2001 From: Alex Wolfe Date: Tue, 19 May 2015 08:48:26 -0700 Subject: [PATCH 11/13] quick start updated --- public/docs/js/latest/quickstart.jade | 134 ++++++++++++------------- public/resources/css/module/_code.scss | 1 + 2 files changed, 65 insertions(+), 70 deletions(-) diff --git a/public/docs/js/latest/quickstart.jade b/public/docs/js/latest/quickstart.jade index 6bb6aa8725..495572c5cf 100644 --- a/public/docs/js/latest/quickstart.jade +++ b/public/docs/js/latest/quickstart.jade @@ -25,14 +25,14 @@ TypeScript type definitions are typically published in a repo called DefinitelyTyped. To fetch one of the type definitions to the local directory, we use the tsd package manager. - pre.prettyprint + code-example. $ npm install -g tsd $ tsd query angular2 --action install p. Next, create two empty files, index.html and app.ts, both at the root of the project: - pre.prettyprint + code-example. $ touch app.ts index.html // STEP 2 - Start the TypeScript compiler ########################## @@ -45,7 +45,7 @@ compiler in --watch mode, but it is also possible to do the translation in the browser as files are loaded, or configure your editor or IDE to do it. - pre.prettyprint + code-example. $ npm install -g typescript@^1.5.0-beta $ tsc --watch -m commonjs -t es5 --emitDecoratorMetadata app.ts @@ -54,12 +54,12 @@ h2#section-transpile 3. Import Angular p Inside of app.ts, import the type definitions from Angular: - pre.prettyprint - code /// <reference path="typings/angular2/angular2.d.ts" /> + code-example. + <reference path="typings/angular2/angular2.d.ts" > p Now your editor should be able to complete the available imports: - pre.prettyprint - code import {Component, View, bootstrap} from 'angular2/angular2'; + code-example. + import {Component, View, bootstrap} from 'angular2/angular2'; p. The above import statement uses ES6 module syntax to import three symbols from the Angular module. @@ -80,23 +80,22 @@ which is an ES6 class, and the decorators which tell Angular how to place the component into the page. - pre.prettyprint.linenums - code. - // Annotation section - @Component({ - selector: 'my-app' - }) - @View({ - template: '<h1>Hello {{ name }}</h1>' - }) - // Component controller - class MyAppComponent { - name: string; + code-example(language="javascript" format="linenums"). + // Annotation section + @Component({ + selector: 'my-app' + }) + @View({ + template: '<h1>Hello {{ name }}</h1>' + }) + // Component controller + class MyAppComponent { + name: string; - constructor() { - this.name = 'Alice'; - } + constructor() { + this.name = 'Alice'; } + } .l-sub-section h3 @Component and @View annotations @@ -108,14 +107,13 @@ 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. - pre.prettyprint.linenums - code. - @Component({ - selector: 'my-app' // Defines the <my-app></my-app> tag - }) - @View({ - template: '<h1>Hello {{ name }}</h1>' // Defines the inline template for the component - }) + code-example(language="javascript" format="linenums"). + @Component({ + selector: 'my-app' // Defines the <my-app></my-app> tag + }) + @View({ + template: '<h1>Hello {{ name }}</h1>' // Defines the inline template for the component + }) p. The annotations above specify an HTML tag of <my-app> @@ -128,14 +126,13 @@ The component controller is the backing of the component's template. This component controller uses TypeScript class syntax. - pre.prettyprint.linenums - code. - class MyAppComponent { - name: string; - constructor() { - this.name = 'Alice'; - } + code-example(language="javascript" format="linenums"). + class MyAppComponent { + name: string; + constructor() { + this.name = 'Alice'; } + } p. Templates read from their component controllers. Templates have access to any properties @@ -158,8 +155,8 @@ At the bottom of app.ts, call the bootstrap() function to load your new component into its page: - pre.prettyprint.linenums - code bootstrap(MyAppComponent); + code-example(language="javaScript"). + bootstrap(MyAppComponent); p. @@ -178,22 +175,21 @@ include the traceur-runtime and the Angular bundle. Instantiate the my-app component in the body. - pre.prettyprint.linenums - code. - <!-- index.html --> - <html> - <head> - <title>Angular 2 Quickstart</title> - <script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script> - <script src="https://code.angularjs.org/2.0.0-alpha.22/angular2.dev.js"></script> - </head> - <body> + code-example(language="html" format="linenums"). + <!-- index.html --> + <html> + <head> + <title>Angular 2 Quickstart</title> + <script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script> + <script src="https://code.angularjs.org/2.0.0-alpha.22/angular2.dev.js"></script> + </head> + <body> - <!-- The app component created in app.ts --> - <my-app></my-app> + <!-- The app component created in app.ts --> + <my-app></my-app> - </body> - </html> + </body> + </html> // STEP 7 - Declare the HTML ########################## .l-main-section @@ -215,22 +211,20 @@ Add the System.js dependency in the <head> tag, so that it looks like: - pre.prettyprint.linenums - code. - <head> - <title>Angular 2 Quickstart</title> - <script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script> - <script src="https://jspm.io/system@0.16.js"></script> - <script src="https://code.angularjs.org/2.0.0-alpha.22/angular2.dev.js"></script> - </head> + code-example(language="html" format="linenums"). + <head> + <title>Angular 2 Quickstart</title> + <script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script> + <script src="https://jspm.io/system@0.16.js"></script> + <script src="https://code.angularjs.org/2.0.0-alpha.22/angular2.dev.js"></script> + </head> p. Add the following module-loading code: - pre.prettyprint.linenums - code. - <my-app></my-app> - <script>System.import('app');</script> + code-example(language="html" format="linenums"). + <my-app></my-app> + <script>System.import('app');</script> // STEP 8 - Run a local server ########################## @@ -247,11 +241,11 @@ sudo npm ...) For example: - pre.prettyprint.code. - # From the directory that contains index.html: - npm install -g http-server # Or sudo npm install -g http-server - http-server # Creates a server at localhost:8080 - # In a browser, visit localhost:8080/index.html + code-example. + # From the directory that contains index.html: + npm install -g http-server # Or sudo npm install -g http-server + http-server # Creates a server at localhost:8080 + # In a browser, visit localhost:8080/index.html // WHAT'S NEXT... ########################## diff --git a/public/resources/css/module/_code.scss b/public/resources/css/module/_code.scss index 063a788e55..19cbf5607c 100644 --- a/public/resources/css/module/_code.scss +++ b/public/resources/css/module/_code.scss @@ -50,6 +50,7 @@ code { background: none; font-size: 15px; + padding: 0px; } ol { From 363373d405aa3a98c7ac4085e05ceb599b25f7ce Mon Sep 17 00:00:00 2001 From: Alex Wolfe Date: Tue, 19 May 2015 08:56:34 -0700 Subject: [PATCH 12/13] style guide update --- .../_includes/styleguide/_code-examples.jade | 17 +++++++++++++++++ public/resources/css/layout/_layout.scss | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/public/docs/_includes/styleguide/_code-examples.jade b/public/docs/_includes/styleguide/_code-examples.jade index c9987f7739..e7b1e31edc 100644 --- a/public/docs/_includes/styleguide/_code-examples.jade +++ b/public/docs/_includes/styleguide/_code-examples.jade @@ -11,18 +11,35 @@ li format linenums (or linenums:4 specify starting line) .showcase-content + + .l-sub-section + h3 Inline Code Examples + + p. + Inline code example {{username}} + + code-example(format="linenums" language="html" escape="html"). + Inline code example {{username}} + + p. + Notice the ng-non-bindable attribute. This is only + needed when using code examples inline code-tabs and code-example directives + automatically do this. + .l-sub-section h3 Adding a code example code-example(format="linenums" language="html"). code-example(format="linenums" language="javascript"). //SOME CODE + .l-sub-section h3 Specify starting line number code-example(language="javascript" format="linenums:4"). code-example(language="html" format="linenums:4"). var title = "This starts on line four"; + .l-sub-section h3 Specify a language diff --git a/public/resources/css/layout/_layout.scss b/public/resources/css/layout/_layout.scss index 318808bbb0..02aaa4c104 100644 --- a/public/resources/css/layout/_layout.scss +++ b/public/resources/css/layout/_layout.scss @@ -118,6 +118,11 @@ padding: ($unit * 3) ($unit * 1); } + code { + background: $fog; + color: $steel; + } + &:last-child { margin: 0; } From ed597245eeb2aa344d714d07b84e4cd0c8cceb68 Mon Sep 17 00:00:00 2001 From: Alex Wolfe Date: Tue, 19 May 2015 09:21:11 -0700 Subject: [PATCH 13/13] update dart guide --- .../dart/latest/guide/displaying-data.jade | 430 +++++++++--------- .../dart/latest/guide/making-components.jade | 58 ++- public/docs/dart/latest/guide/setup.jade | 79 ++-- public/docs/dart/latest/guide/user-input.jade | 229 +++++----- 4 files changed, 377 insertions(+), 419 deletions(-) diff --git a/public/docs/dart/latest/guide/displaying-data.jade b/public/docs/dart/latest/guide/displaying-data.jade index 4f3bdb8d70..cfb45fe19c 100644 --- a/public/docs/dart/latest/guide/displaying-data.jade +++ b/public/docs/dart/latest/guide/displaying-data.jade @@ -16,48 +16,44 @@ 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; + code-tabs + code-pane(language="dart" name="main.dart" format="linenums"). + // 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; + 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 '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> + main() { + reflector.reflectionCapabilities = new ReflectionCapabilities(); + bootstrap(DisplayComponent); + } + code-pane(language="html" name="index.html" format="linenums"). + <!-- 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.22 - browser: any + <display></display> + <script type="application/dart" src="main.dart"></script> + <script src="packages/browser/dart.js"></script> + </body> + </html> + code-pane(language="yaml" name="pubspec.yaml" format="linenums"). + # pubspec.yaml + name: displaying_data + description: Dart version of Angular 2 example, Displaying Data + version: 0.0.1 + dependencies: + angular2: 2.0.0-alpha.22 + browser: any p. All of this code should look familiar from the previous page, except for the library and part statements @@ -78,30 +74,28 @@ named show_properties.dart, and add the following: - pre.prettyprint.lang-dart - code. - // web/show_properties.dart - part of displaying_data; + code-example(language="dart" format="linenums"). + // web/show_properties.dart + part of displaying_data; - @Component( - selector: 'display' - ) - @View( - template: ''' - <p>My name: {{ myName }}</p> - ''' - ) - class DisplayComponent { - String myName = 'Alice'; - } + @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> + code-example(language="html"). + <p>My name: {{ myName }}</p> p. Angular will automatically pull the value of myName and @@ -134,17 +128,15 @@ 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> + code-example(language="html"). + <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. + code-example(language="dart" format="linenums"). class DisplayComponent { String myName = 'Alice'; String time; @@ -166,44 +158,41 @@ 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']; - } + code-example(language="dart" format="linenums"). + 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> - ''' - ) + code-example(language="dart" format="linenums"). + @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] - ) + code-example(language="dart" format="linenums"). + @View( + template: ''' + // ...HTML... + ''', + directives: const[For] + ) p Reload and you've got your list of friends! p. @@ -213,11 +202,10 @@ 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> + code-example(language="html" format="linenums"). + <li *for="#name of friendNames"> + {{ name }} + </li> p The way to read this is: ul @@ -241,14 +229,13 @@ 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; + code-example(language="dart" format="linenums"). + // web/friends_service.dart + part of displaying_data; - class FriendsService { - List<String> friendNames = ['Aarav', 'Martín', 'Shannon', 'Ariana', 'Kai']; - } + class FriendsService { + List<String> friendNames = ['Aarav', 'Martín', 'Shannon', 'Ariana', 'Kai']; + } .callout.is-helpful header Note @@ -260,29 +247,27 @@ 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; + code-example(language="dart" format="linenums"). + // In web/show_properties.dart + class DisplayComponent { + String myName = 'Alice'; + List friendNames; - DisplayComponent(FriendsService friendsService) { - friendNames = friendsService.names; - } + 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] - ) + code-example(language="dart" format="linenums"). + @Component( + selector: 'display', + injectables: const[FriendsService] + ) .l-main-section h2#Conditionally-displaying-data-with-If Conditionally display data using *if @@ -292,17 +277,15 @@ 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> + code-example(language="html"). + <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] + code-example(language="dart"). + 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. @@ -313,131 +296,124 @@ 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; + code-tabs + code-pane(language="dart" name="show_properties.dart" format="linenums"). + // 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; + @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; - } + DisplayComponent(FriendsService friendsService) { + friendNames = friendsService.names; } - pre.prettyprint.lang-dart(data-name="friends_service.dart") - code. - // web/friends_service.dart - part of displaying_data; + } + code-pane(language="dart" name="friends_service.dart" format="linenums"). + // 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; + class FriendsService { + List<String> names = ['Aarav', 'Martín', 'Shannon', 'Ariana', 'Kai']; + } + code-pane(language="dart" name="main.dart" format="linenums"). + // web/main.dart + library displaying_data; - import 'dart:async'; + 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; + 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'; + 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> + main() { + reflector.reflectionCapabilities = new ReflectionCapabilities(); + bootstrap(DisplayComponent); + } + code-pane(language="html" name="index.html" format="linenums"). + <!-- web/index.html --> + <!DOCTYPE html> + <html> + <head> + <link rel="stylesheet" href="style.css"> + </head> + <body> - <display></display> + <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.22 - browser: any + <script type="application/dart" src="main.dart"></script> + <script src="packages/browser/dart.js"></script> + </body> + </html> + code-pane(language="yaml" name="pubspec.yaml" format="linenums"). + # pubspec.yaml + name: displaying_data + description: Dart version of Angular 2 example, Displaying Data + version: 0.0.1 + dependencies: + angular2: 2.0.0-alpha.22 + 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. + 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. + 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... + code-tabs + code-pane(language="dart" name="main.dart" format="linenums"). + // web/main.dart + library displaying_data; + // imports... + part 'show_properties.dart'; + // Code goes here... + code-pane(language="dart" name="show_properties.dar" format="linenums"). + // 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. + 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. + 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. + 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/making-components.jade b/public/docs/dart/latest/guide/making-components.jade index 63418c0f04..aacb4a9697 100644 --- a/public/docs/dart/latest/guide/making-components.jade +++ b/public/docs/dart/latest/guide/making-components.jade @@ -10,41 +10,39 @@ you can create a parent component that uses a <child> component like so: - pre.prettyprint.linenums.lang-dart - code. - part of making_components; + code-example(language="dart" format="linenums"). + 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"; - } + @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; + code-example(language="dart" format="linenums"). + part of making_components; - @Component( - selector: 'child' - ) - @View( - template: ''' - <p> {{ message }} </p> - ''' - ) - class ChildComponent { - String message = "I'm the child"; - } + @Component( + selector: 'child' + ) + @View( + template: ''' + <p> {{ message }} </p> + ''' + ) + class ChildComponent { + String message = "I'm the child"; + } //p. [TODO: Motivate communication between components with iterator example that passes index to the child] diff --git a/public/docs/dart/latest/guide/setup.jade b/public/docs/dart/latest/guide/setup.jade index 77fec51e0f..e301e6cad7 100644 --- a/public/docs/dart/latest/guide/setup.jade +++ b/public/docs/dart/latest/guide/setup.jade @@ -24,15 +24,14 @@ 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.22 - browser: any + code-example(language="yaml"). + # pubspec.yaml + name: getting_started + description: Dart version of Angular 2 example, Getting Started + version: 0.0.1 + dependencies: + angular2: 2.0.0-alpha.22 + browser: any p. Run pub get to download the packages your app depends on. (Dart-savvy editors and IDEs @@ -51,26 +50,25 @@ 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; + code-example(language="javascript"). + // 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 { - } + @Component( + selector: 'my-app' + ) + @View( + template: '<h1>My first Angular 2 App</h1>' + ) + class AppComponent { + } - main() { - reflector.reflectionCapabilities = new ReflectionCapabilities(); - bootstrap(AppComponent); - } + main() { + reflector.reflectionCapabilities = new ReflectionCapabilities(); + bootstrap(AppComponent); + } .l-main-section h2#section-create-an-entry-point Create an HTML file @@ -79,20 +77,19 @@ 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> + code-example(language="html"). + <!-- 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! diff --git a/public/docs/dart/latest/guide/user-input.jade b/public/docs/dart/latest/guide/user-input.jade index 9fba3e3182..2e3e718810 100644 --- a/public/docs/dart/latest/guide/user-input.jade +++ b/public/docs/dart/latest/guide/user-input.jade @@ -5,9 +5,8 @@ p. You can specify the event handler—a method in the component controller—like this: - pre.prettyprint.lang-html - code. - <input (keyup)="myControllerMethod()"> + code-example(language="html"). + <input (keyup)="myControllerMethod()"> p. As in previous examples, you can make element references available to other parts of the template as a local @@ -17,10 +16,9 @@ - pre.prettyprint.lang-html - code. - <input #myname (keyup)> - <p>{{myname.value}}</p> + code-example(language="html"). + <input #myname (keyup)> + <p>{{myname.value}}</p> p.text-body(ng-non-bindable). In that example, #myname creates a local variable in the template that @@ -46,16 +44,15 @@ Then add a method that adds new items to the list. - pre.prettyprint.lang-dart - code. - class TodoList { - List<String> todos = - ['Eat breakfast', 'Walk dog', 'Breathe', 'Learn Angular']; + code-example(language="dart" format="linenums"). + class TodoList { + List<String> todos = + ['Eat breakfast', 'Walk dog', 'Breathe', 'Learn Angular']; - addTodo(String todo) { - todos.add(todo); - } + addTodo(String todo) { + todos.add(todo); } + } .callout.is-helpful header Production Best Practice @@ -73,13 +70,12 @@ Using the *for iterator, create an <li> for each item in the todos list and set its text to the value. - pre.prettyprint.lang-html - code. - <ul> - <li *for="#todo of todos"> - {{ todo }} - </li> - </ul> + code-example(language="html" format="linenums"). + <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 @@ -87,18 +83,16 @@ 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> + code-example(language="html"). + <input #todotext> p. 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> + code-example(language="html"). + <button (click)="addTodo(todotext.value)">Add Todo</button> p. To make pressing Enter do something useful, @@ -107,13 +101,59 @@ dart:html, so be sure to import that library. - .code-box - pre.prettyprint.lang-dart(data-name="todo_list.dart") - code. - // In the template: - <input #todotext (keyup)="doneTyping(\$event)"> + code-tabs + code-pane(language="dart" name="todo_list.dart" format="linenums"). + // In the template: + <input #todotext (keyup)="doneTyping(\$event)"> + + // In the component controller class: + doneTyping(KeyboardEvent event) { + if (event.keyCode == KeyCode.ENTER) { + InputElement e = event.target; + addTodo(e.value); + e.value = null; + } + } + code-pane(language="dart" name="main.dart" format="linenums"). + library user_input; + + import 'dart:html'; + ... + +.l-main-section + h2#section-final-code Final code + + code-tabs + code-pane(language="dart" name="todo_list.dart" format="linenums"). + // web/todo_list.dart + part of user_input; + + @Component( + selector: 'todo-list' + ) + @View( + // Without r before ''' (a raw string), $event breaks Angular. + // An alternative to a raw string is to use \$event instead. + template: r''' + <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); + } - // In the component controller class: doneTyping(KeyboardEvent event) { if (event.keyCode == KeyCode.ENTER) { InputElement e = event.target; @@ -121,96 +161,43 @@ e.value = null; } } - pre.prettyprint.lang-dart(data-name="main.dart") - code. - library user_input; + } + code-pane(language="dart" name="main.dart" format="linenums"). + // web/main.dart + library user_input; - import 'dart:html'; - ... + import 'dart:html'; + import 'package:angular2/angular2.dart'; + import 'package:angular2/src/reflection/reflection.dart' show reflector; + import 'package:angular2/src/reflection/reflection_capabilities.dart' show ReflectionCapabilities; -.l-main-section - h2#section-final-code Final code + part 'todo_list.dart'; - .code-box - pre.prettyprint.lang-dart(data-name="todo_list.dart") - code. - // web/todo_list.dart - part of user_input; + main() { + reflector.reflectionCapabilities = new ReflectionCapabilities(); + bootstrap(TodoList); + } + code-pane(language="html" name="index.html" format="linenums"). + <!-- web/index.html --> + <!DOCTYPE html> + <html> + <head> + <link rel="stylesheet" href="style.css"> + </head> + <body> - @Component( - selector: 'todo-list' - ) - @View( - // Without r before ''' (a raw string), $event breaks Angular. - // An alternative to a raw string is to use \$event instead. - template: r''' - <ul> - <li *for="#todo of todos"> - {{ todo }} - </li> - </ul> + <todo-list></todo-list> - <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.keyCode == KeyCode.ENTER) { - InputElement e = event.target; - addTodo(e.value); - e.value = null; - } - } - } - pre.prettyprint.lang-dart(data-name="main.dart") - code. - // web/main.dart - library user_input; - - import 'dart:html'; - - 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 'todo_list.dart'; - - main() { - reflector.reflectionCapabilities = new ReflectionCapabilities(); - bootstrap(TodoList); - } - pre.prettyprint.lang-html(data-name="html") - code. - <!-- web/index.html --> - <!DOCTYPE html> - <html> - <head> - <link rel="stylesheet" href="style.css"> - </head> - <body> - - <todo-list></todo-list> - - <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: user_input - description: Dart version of Angular 2 example, Responding to User Input - version: 0.0.1 - dependencies: - angular2: 2.0.0-alpha.22 - browser: any + <script type="application/dart" src="main.dart"></script> + <script src="packages/browser/dart.js"></script> + </body> + </html> + code-pane(language="yaml" name="pubspec.yaml" format="linenums"). + # pubspec.yaml + name: user_input + description: Dart version of Angular 2 example, Responding to User Input + version: 0.0.1 + dependencies: + angular2: 2.0.0-alpha.22 + browser: any