how to access property in a observable

2019-08-03 03:01发布

I want to access the property in 'selectedCeremonyToUpdate()' observable whose property name is in 'name'. If 'name' contains 'City' then i want

self.edit = function (data, event, name) {
alert("In " + self.selectedCeremonyToUpdate().City());
}

how to do this..

标签: knockout.js
1条回答
姐就是有狂的资本
2楼-- · 2019-08-03 03:27

You can access object properties by name using array semantics. Try this:

self.selectedCeremonyToUpdate()[name]()
查看更多
登录 后发表回答