Created
October 29, 2014 04:58
-
-
Save brendanmckenzie/91ff3a962032995e16c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (window) { | |
'use strict'; | |
function ReferenceSelector($http) { | |
var directive = { | |
restrict: 'E', | |
replace: true, | |
scope: { | |
model: '=ngModel', | |
disabled: '=ngDisabled' | |
} | |
}; | |
directive.template = '<select ng-options="a.id as a.displayText for a in options"></select>'; | |
directive.link = function (scope, element, attrs) { | |
$http.get('/api/references/' + attrs.type).success(function (data) { | |
scope.options = data; | |
}); | |
} | |
return directive; | |
} | |
window.app.directive('referenceSelector', ['$http', ReferenceSelector]); | |
})(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment