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 characters
| const matches = function(matchNode, name/*, key */) { | |
| const data = getData(matchNode); | |
| return name === data.name // && key === data.key; | |
| }; | |
| function renderDOM(name) { | |
| if (currentNode && matches(currentNode, name/*, key */)) { | |
| return currentNode; | |
| } |
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 characters
| function text(value) { | |
| nextNode(); | |
| const node = renderDOM('#text'); | |
| // update | |
| // checks for text updates | |
| const data = getData(node); | |
| if (data.text !== value) { | |
| data.text = (value); | |
| node.data = value; |
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 characters
| function patch(node, fn, data) { | |
| currentNode = node; | |
| enterNode(); | |
| fn(data); | |
| exitNode(); | |
| }; |
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 characters
| function render(data) { | |
| elementOpen('h1'); | |
| { | |
| text('Hello, ' + data.user) | |
| } | |
| elementClose('h1'); | |
| elementOpen('ul') | |
| { | |
| elementOpen('li'); | |
| { |
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 characters
| @Component({ | |
| selector: 'my-app', | |
| template: ` | |
| <h2>Parent</h2> | |
| <child [prop1]="x"></child> | |
| ` | |
| }) | |
| export class AppComponent { | |
| x = 1; | |
| } |
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 characters
| function updateDirectives(_ck,_v) { | |
| var currVal_0 = '#efefef'; | |
| _ck(_v,1,0,currVal_0); |
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 characters
| <comp color="#efefef"></comp> |
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 characters
| var _c0 = ["color", "#efefef"]; | |
| AppComponent.ngComponentDef = i0.ɵdefineComponent({ | |
| type: AppComponent, | |
| selectors: [["my-app"]], | |
| ... | |
| template: function AppComponent_Template(rf, ctx) { | |
| // create mode | |
| if (rf & 1) { | |
| i0.ɵE(0, "child", _c0); <========== used only in create mode | |
| i0.ɵe(); |
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 characters
| @Component({ | |
| ..., | |
| template: '<ng-template #foo></ng-template>' | |
| }) | |
| class SomeComponent { | |
| @ViewChild('foo', {read: ElementRef}) query; | |
| } |
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 characters
| <input type="text" value="Alexey"> | |
| <button>Increment</button> |