Phi: allow setting of properties via hash
Defining the set of properties for the knockoutjs bridge via array of array is clumsy, allow setting those via an object aka hash is much easier.
This commit is contained in:
parent
0187820627
commit
7bfa20933b
1 changed files with 11 additions and 3 deletions
|
@ -162,9 +162,17 @@ define(['knockout'], function(ko) {
|
|||
|
||||
self.aliases = {};
|
||||
self.setAliases = function(arg) {
|
||||
arg.forEach(function(a) {
|
||||
self.aliases[a[0]] = a[1];
|
||||
});
|
||||
if( Object.prototype.toString.call( arg ) === '[object Array]' ) {
|
||||
// [
|
||||
// [ shortcut, propertypath ],
|
||||
// [ othercut, otherproperty ],
|
||||
// ]
|
||||
arg.forEach(function(a) {
|
||||
self.aliases[a[0]] = a[1];
|
||||
});
|
||||
} else {
|
||||
self.aliases = arg;
|
||||
}
|
||||
}
|
||||
|
||||
self.props = {};
|
||||
|
|
Loading…
Add table
Reference in a new issue