Last active
August 29, 2015 14:19
-
-
Save kaleb/f90a79e3275fe5dc21c8 to your computer and use it in GitHub Desktop.
Revisions
-
kaleb revised this gist
Apr 14, 2015 . 1 changed file with 12 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ <!DOCTYPE html> <meta charset="utf-8"> <h2>Static - Items 1 through 3</h2> <custom-element> <span>item 1.1</span> @@ -11,7 +11,17 @@ <h2>Static Items 1 through 3</h2> <hr /> <h2>Dynamic Attempt 1 - Items 1 through 3</h1> <custom-element> <!-- ko foreach: { data: ['item 2.1', 'item 2.2', 'item 2.3'], as: 'item' } --> <span data-bind="text: item"></span> <!-- /ko --> </custom-element> <hr /> <h2>Dynamic Attempt 2 - Items 1 through 3</h1> <custom-element data-bind="foreach: { data: ['item 2.1', 'item 2.2', 'item 2.3'], as: 'item' }"> <span data-bind="text: item"></span> -
kaleb revised this gist
Apr 13, 2015 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,3 +3,6 @@ Purpose I would like to be able to have a Knockout custom component that can have either static content or dynamic content using the foreach binding. [view demo](http://bl.ocks.org/kaleb/f90a79e3275fe5dc21c8) -
kaleb revised this gist
Apr 13, 2015 . 2 changed files with 11 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ Purpose ======= I would like to be able to have a Knockout custom component that can have either static content or dynamic content using the foreach binding. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ <!DOCTYPE html> <meta charset="utf-8"> <h2>Static Items 1 through 3</h2> <custom-element> <span>item 1.1</span> <span>item 1.2</span> @@ -8,6 +11,8 @@ <hr /> <h2>Dynamic Items 1 through 3</h1> <custom-element data-bind="foreach: { data: ['item 2.1', 'item 2.2', 'item 2.3'], as: 'item' }"> <span data-bind="text: item"></span> </custom-element> @@ -17,7 +22,7 @@ <script id="tmpl" type="text/html"> <!-- ko foreach: { data: $componentTemplateNodes, as: 'node' } --> <!-- ko if: node.nodeType == 1 --> <h3 data-bind="template: { nodes: [node] }"></h3> <!-- /ko --> <!-- /ko --> </script> -
kaleb revised this gist
Apr 13, 2015 . 2 changed files with 19 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,10 +8,25 @@ <hr /> <custom-element data-bind="foreach: { data: ['item 2.1', 'item 2.2', 'item 2.3'], as: 'item' }"> <span data-bind="text: item"></span> </custom-element> <script src="//rawgit.com/knockout/knockout/v3.3.0/dist/knockout.debug.js"></script> <script id="tmpl" type="text/html"> <!-- ko foreach: { data: $componentTemplateNodes, as: 'node' } --> <!-- ko if: node.nodeType == 1 --> <h1 data-bind="template: { nodes: [node] }"></h1> <!-- /ko --> <!-- /ko --> </script> <script> ko.components.register('custom-element', { template: { element: 'tmpl' } }); ko.applyBindings(); </script> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +0,0 @@ -
kaleb created this gist
Apr 13, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ <!DOCTYPE html> <meta charset="utf-8"> <custom-element> <span>item 1.1</span> <span>item 1.2</span> <span>item 1.3</span> </custom-element> <hr /> <custom-element data-bind="foreach: ['item 2.1', 'item 2.2', 'item 2.3']"></custom-element> <script src="//rawgit.com/knockout/knockout/v3.3.0/dist/knockout.debug.js"></script> <script src="main.js"></script> <script id="tmpl" type="text/html"> <!-- ko template: { foreach: $componentTemplateNodes, nodes: [$data] } --><!-- /ko --> </script> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ ko.components.register('custom-element', { template: { element: 'tmpl' } }); ko.applyBindings();