Last active
August 29, 2015 14:08
-
-
Save brendanmckenzie/2510f8e009641a50ad91 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(ReferenceSvc, $compile) { | |
var directive = { | |
restrict: 'E', | |
replace: true, | |
scope: { | |
model: '=xgModel' | |
}, | |
template: '<select ng-options="a.id as a.displayText for a in options" ng-model="model"></select>' | |
}; | |
directive.link = function (scope, element, attrs) { | |
ReferenceSvc.get(attrs.refType, function (data) { | |
scope.options = data; | |
}); | |
} | |
return directive; | |
} | |
window.app.directive('referenceSelector', ['ReferenceSvc', '$compile', ReferenceSelector]); | |
})(window); |
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
<reference-selector ref-type="ProfileMaritalStatus" xg-model="profile.maritalStatusId" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment