AngularJS select directive with advanced functionality