2016-08-10 14 views
2

次のコードでngrx/storeサンプルプロジェクトを少し再作成しようとしていますが、これはTODOアプリケーションではかなり過剰ですが、 :私が観察輸入上のさまざまなバリエーションの束を試みたが、それは問題ではしていないようですので、私ngrx/store selectが存在しません

Property 'select' does not exist on type 'Observable<TodoState>'. 
Property 'select' does not exist on type 'Observable<AppState>'. 

// State Model 
interface Todo { 
    id: number; 
    text: string; 
    completed: boolean; 
} 

interface TodoState { 
    entities: Todo[]; 
} 

interface AppState { 
    todos: TodoState; 
} 

// State Retrieval 
getTodos() { 
    return (state: Observable<TodoState>) => state.select(s => s.entities); 
} 

getTodoState() { 
    return (state: Observable<AppState>) => state.select(s => s.todos); 
} 

getTodosCollection() { 
    return compose(this.getTodos(), this.getTodoState()); 
} 

@Component({...}) 
class App { 
    // I'd think I should be able to type this to Array<Todo>, 
    // but that throws a compile-time error. 
    // Also, I'm assuming the $ is convention to designate 
    // a stream. 
    todos$: Observable<any>; 

    constructor(private store:Store<AppState>) { 
    this.todos = store.let(this.getTodosCollection()); 
    } 

} 

このコードは2つのコンパイル時のエラーを作成していますサンプルアプリケーションの持つ機能を使いました:

import {Observable} from 'rxjs/Observable'; 

ご協力いただければ幸いです!

答えて

5

あなたが選択インポートしてみましょう、次のインポートを追加しようとしなかったように見えます:

import '@ngrx/core/add/operator/select'; 
import 'rxjs/add/operator/let'; 
+0

これはそれをやりました!助けてくれてありがとう! – dardo

関連する問題