|
1 | | -function customDirective(){ |
| 1 | +function customDirective() { |
2 | 2 | return { |
3 | 3 | restrict : "E", |
4 | | - //replace= true; |
5 | | - template : '<control><input type="text" style="background-color: #3278b3; color: #8dd0ff" class="jsf-control-string jsf-control form-control" ng-change="vm.modelChanged()" ng-model="vm.modelValue[vm.fragment]" /></control>', |
| 4 | + template : '<jsonforms-control>' + |
| 5 | + '<input type="text" style="background-color: #3278b3; color: #8dd0ff" class="jsf-control-string jsf-control form-control" ng-change="vm.modelChanged()" ng-model="vm.modelValue[vm.fragment]" />' + |
| 6 | + '</jsonforms-control>', |
6 | 7 | controller : customController, |
7 | | - controllerAs : 'vm', |
| 8 | + controllerAs : 'vm' |
8 | 9 | }; |
9 | 10 | } |
10 | | -function CustomControlRendererTester (element, dataSchema, dataObject,pathResolver ){ |
11 | | - if(element.type!='Control') |
| 11 | +/** |
| 12 | + * @return {number} |
| 13 | + */ |
| 14 | +function CustomControlRendererTester (element, dataSchema, dataObject,pathResolver ) { |
| 15 | + if(element.type !== 'Control') |
12 | 16 | return -1; |
13 | | - let schemaPath=element['scope']['$ref']; |
14 | | - if(schemaPath != undefined && schemaPath.endsWith("firstName")) |
| 17 | + var schemaPath = element['scope']['$ref']; |
| 18 | + if(schemaPath !== undefined && schemaPath.endsWith("firstName")) |
15 | 19 | return 100; |
16 | 20 | return -1; |
17 | 21 | } |
18 | | -let customController=['$scope','PathResolver', function ($scope,refResolver) { |
| 22 | +var customController = ['$scope','PathResolver', function ($scope,refResolver) { |
19 | 23 | var vm = this; |
20 | | - vm.fragment=refResolver.lastFragment($scope.uiSchema.scope.$ref); |
21 | | - vm.modelValue=refResolver.resolveToLastModel($scope.data,$scope.uiSchema.scope.$ref); |
22 | | -}] |
| 24 | + vm.fragment = refResolver.lastFragment($scope.uischema.scope.$ref); |
| 25 | + vm.modelValue = refResolver.resolveToLastModel($scope.data,$scope.uischema.scope.$ref); |
| 26 | +}]; |
23 | 27 |
|
24 | 28 | var app = angular.module('makeithappen'); |
25 | | -app.directive('customControl', customDirective) |
| 29 | +app.directive('customControl', customDirective); |
26 | 30 | app.run(['RendererService', function(RendererService) { |
27 | | - RendererService.register("custom-control",CustomControlRendererTester); |
| 31 | + RendererService.register("custom-control", CustomControlRendererTester); |
28 | 32 | }]); |
0 commit comments