Views vs Components in Ember.js

前端 未结 3 1200
甜味超标
甜味超标 2020-12-12 09:27

I am learning ember.js, and I am trying to understand the difference between a view and a component. I see both as a way of making reusable components.

From Ember\'

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-12 10:21

    As it stands now - v2.x being current stable release - views have been completely deprecated. It is said that views are being removed from Ember 2.0 API.

    So, using {{view}} keyword in Ember 2.0 will trigger an assertion:

    Assertion Failed: Using {{view}} or any path based on it has been removed in Ember 2.0

    If you have to use views in Ember 2.0 you can use ember-legacy-views addon, which will be compatible with Ember until version 2.4.

    So, to sum up - components are the present (views being removed) and the future - they will also replace controllers. See Routable Components RFC.

提交回复
热议问题