如何在daragula模块angular2中增加json数据

时间:2017-03-14 09:18:36

标签: json angular

 <div class="card-block" [dragula]='"fifth-bag"'>
                   <div>en_GB</div>
                    <div>en_US</div>
                    <div>Telugu</div>
                    <div>HIndi</div>
                    </div>

我需要在语言的地方用json替换数据才有可能

1 个答案:

答案 0 :(得分:0)

<div class="card-block draghe" [dragula]='"fifth-bag"'>
                    <div *ngFor="let lang of langs.test">
                        {{lang.name}}
                    </div>
                </div> 
ngOnInit() {
     this.http.get('/assets/data/language.json')
        .map(res => res.json())
        .subscribe(data => this.langs = data,
                    err => console.log(err),
                    () => console.log('Completed')); }