[search] experimenting with pipes
authorErik Haider Forsén <erikhf@ifi.uio.no>
Thu, 12 Nov 2015 15:01:58 +0000 (16:01 +0100)
committerErik Haider Forsén <erikhf@ifi.uio.no>
Thu, 12 Nov 2015 15:01:58 +0000 (16:01 +0100)
src/components/search/livesearch.ts [new file with mode: 0644]
src/components/search/search.html
src/components/search/search.ts

diff --git a/src/components/search/livesearch.ts b/src/components/search/livesearch.ts
new file mode 100644 (file)
index 0000000..1b94dce
--- /dev/null
@@ -0,0 +1,12 @@
+import {View, CORE_DIRECTIVES} from 'angular2/angular2';
+import {Pipe} from 'angular2/angular2';
+
+
+
+@Pipe({
+    name: 'livesearch'
+})
+export class Livesearch {
+    transform(value, args) { return value * 2; }
+}
+
index 373e5cc..cb5d4b6 100644 (file)
@@ -1 +1,6 @@
-<div style="width: 500px; height: 50px; background: #ff647c; ">Søkefelt! </div>
\ No newline at end of file
+<form class="form-inline">
+    <div class="form-group">
+        <label class="sr-only" for="livesearch">Search</label>
+        <input type="text" class="form-control" id="livesearch" placeholder="Search...">
+    </div>
+</form>
\ No newline at end of file
index f5a52cb..51dc703 100644 (file)
@@ -1,12 +1,24 @@
-import {Component, CORE_DIRECTIVES} from 'angular2/angular2';
+import {Component, View, CORE_DIRECTIVES} from 'angular2/angular2';
+import {Observable} from 'angular2/angular2';
+import {Pipe} from 'angular2/angular2';
+import {Http} from 'angular2/http';
+import {Livesearch} from './livesearch';
 
 @Component({
     selector: 'mou-search',
     directives: [CORE_DIRECTIVES],
-    templateUrl: './components/search/search.html'
+//    templateUrl: './components/search/search.html'
+    template: '{{ 10 | livesearch }}',
+    pipes: [Livesearch]
 })
 
 
-export class Search {
 
+export class Search {
+    data: Object;
+    constructor(http: Http){
+        this.data = http.get('items.json');
+    }
 }
+
+