Commit 812e4c7c by Torkel Ödegaard

refactor: moved array join directive to typecrtipt

parent 85baae1e
export * from './directives/cool_dir'
export * from './directives/array_join'
export * from './routes/module_loader'
export * from './filters/filters'
......
define([
'angular',
'app',
'lodash'
],
function (angular, app, _) {
'use strict';
///<reference path="../../headers/common.d.ts" />
angular
.module('grafana.directives')
.directive('arrayJoin', function() {
return {
restrict: 'A',
require: 'ngModel',
link: function(scope, element, attr, ngModel) {
import angular = require('angular');
import _ = require('lodash');
function split_array(text) {
return (text || '').split(',');
}
export function ArrayJoin()
{
return {
restrict: 'A',
require: 'ngModel',
link: function(scope, element, attr, ngModel) {
function join_array(text) {
if(_.isArray(text)) {
return (text || '').join(',');
} else {
return text;
}
}
function split_array(text) {
return (text || '').split(',');
}
ngModel.$parsers.push(split_array);
ngModel.$formatters.push(join_array);
function join_array(text) {
if(_.isArray(text)) {
return (text || '').join(',');
} else {
return text;
}
};
});
}
ngModel.$parsers.push(split_array);
ngModel.$formatters.push(join_array);
}
};
}
angular.module('grafana.directives').directive('arrayJoin', ArrayJoin);
});
export class CoolDir {
getName() : string {
return "CoolDir";
}
}
define([
'./arrayJoin',
'./dashUpload',
'./grafanaSimplePanel',
'./dashEditLink',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment