Skip to content

Instantly share code, notes, and snippets.

@lega911
Last active December 16, 2015 10:54
Show Gist options
  • Save lega911/09a75ea343523013b525 to your computer and use it in GitHub Desktop.
Save lega911/09a75ea343523013b525 to your computer and use it in GitHub Desktop.
// current
alight.filters.toString = function(exp, scope) {
return function(val) {
return val.toString()
}
}
// new style
alight.filters.toString = function(val, exp, scope) {
return val.toString()
}
// current
alight.filters.format = function(exp, scope, env) {
var fn = scope.$compile(exp);
return {
watchMode: 'deep',
onChange: function(value) {
env.setValue(fn(value))
},
onStop: function(value) {}
}
}
// new style
alight.filters.format = {
watchMode: 'deep',
init: function(exp, scope) {
this.fn = scope.$compile(exp)
},
onChange: function(value) {
this.setValue(this.fn(value))
},
onStop: function() {}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment