Created
January 26, 2014 03:15
-
-
Save kalisjoshua/8627855 to your computer and use it in GitHub Desktop.
AngularJS linking form constructor with dynamic field name
This file contains hidden or 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
| angular.module('app') | |
| .directive('dynamicFields', function () { | |
| return { | |
| link: function ($scope) { | |
| // this hack brought to you by kalisjoshua; plenty of searching | |
| // and one big guess that this might work, only time will tell | |
| $scope.validation[$scope.name] = $scope.validation['{{name}}']; | |
| }, | |
| scope: { | |
| name: '@', | |
| validation: '=' | |
| } | |
| }; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment