我試圖通過{{#link-to}}
幫助程序發送查詢參數,在我的路由中獲取查詢參數,然後根據發送的參數動態更改div的顏色。我可以看到我獲得了正確的ID,但似乎沒有任何信息在頁面上發生。根據查詢參數ember更改div顏色
這裏是我的鏈接幫手
<li>{{#link-to 'usernotification' (query-params highlightedNotification=activeUserNotification.id)
classNames="read-more"}}Read more{{/link-to}}</li>
,這裏是我的路線
export default BaseRoute.extend({
accountService: Ember.inject.service('account'),
userNotificationService: Ember.inject.service('usernotification'),
queryParams: {
highlightedNotification: {
refreshModel:true
}
},
beforeModel(params){
this._super(...arguments);
Ember.$("#"+params.queryParams.highlightedNotification).attr('style', 'background-color: black !important');
},
});
任何人都可以看到,我錯了?