mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Simple list component with array watching
This commit is contained in:
@@ -12,6 +12,10 @@ import {Component} from "angular2/core";
|
||||
<hello-world text="test user"></hello-world>
|
||||
</div>
|
||||
<div class="row">
|
||||
<p>
|
||||
List below is a web component bound to array of items coming from angular.<br>
|
||||
Add/remove buttons control angular array and web component reacts on changes.
|
||||
</p>
|
||||
<simple-list [items]="items"></simple-list>
|
||||
<button (click)="addItem()">add item</button>
|
||||
<button (click)="removeItem()">remove item</button>
|
||||
|
@@ -1,3 +1,6 @@
|
||||
<script src="/bower_components/underscore/underscore-min.js"></script>
|
||||
<script src="/bower_components/underscore-observable-arrays/underscore-observe.js"></script>
|
||||
|
||||
<!-- Defines element markup -->
|
||||
<template>
|
||||
<ul id="list"></ul>
|
||||
@@ -31,11 +34,12 @@
|
||||
};
|
||||
*/
|
||||
|
||||
/*
|
||||
var self = this;
|
||||
// TODO: unobserve for old _items value if needed
|
||||
_.observe(_items, function(new_array, old_array) {
|
||||
|
||||
_items = new_array || [];
|
||||
self._render();
|
||||
});
|
||||
*/
|
||||
|
||||
this._render();
|
||||
}
|
||||
|
Reference in New Issue
Block a user