I\'ve been reading this nice recent article about new .component()
helper in Angular 1.5, which is supposed to help everyone to migrate to Angular 2 eventually.
Update (from august 22, 2017): $inject is recommended way for doing this in AngularJS. Read Styleguide: Styleguide link and AngularJS docs: AngularJS docs
For using DOM bindings in components instead of creating directive with link function you can inject '$element' or other service you need in your controller function, e.g.
app.component('pickerField', {
controller: PickerField,
template: 'Your template goes here'
});
PickerField.$inject = ['$element'];
function PickerField(element) {
var self = this;
self.model = self.node.model;
self.open = function() {
console.log('smth happens here');
};
element.bind('click', function(e) {
console.log('clicked from component', e);
self.open();
});
}