mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Simple list component with array watching
This commit is contained in:
parent
1f71e3798e
commit
6cb98e516f
@ -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();
|
||||
}
|
||||
|
@ -31,6 +31,8 @@
|
||||
"paper-toolbar": "~1.1.4",
|
||||
"iron-signals": "~1.0.3",
|
||||
"paper-item": "~1.1.4",
|
||||
"paper-dropdown-menu": "~1.1.3"
|
||||
"paper-dropdown-menu": "~1.1.3",
|
||||
"underscore": "^1.8.3",
|
||||
"underscore-observable-arrays": "*"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user