当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript angular.fromJson函数代码示例

本文整理汇总了TypeScript中angular.fromJson函数的典型用法代码示例。如果您正苦于以下问题:TypeScript fromJson函数的具体用法?TypeScript fromJson怎么用?TypeScript fromJson使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了fromJson函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: wrap

 private wrap(event: any): void {
   if (event.key === "idle.expiry" && event.newValue && event.newValue !== event.oldValue) {
     let val = angular.fromJson(event.newValue);
     if (val.id === this.id) {
       return;
     }
     this.interruptTimers(true);
   }
 }
开发者ID:Kurtz1993,项目名称:angular-idle-service,代码行数:9,代码来源:idle.provider.ts

示例2:

 }).map(item => {
   return {
     refId: item.refId,
     scenarioId: item.scenarioId,
     intervalMs: options.intervalMs,
     maxDataPoints: options.maxDataPoints,
     stringInput: item.stringInput,
     jsonInput: angular.fromJson(item.jsonInput),
   };
 });
开发者ID:Sensetif,项目名称:grafana,代码行数:10,代码来源:datasource.ts

示例3: beforeEach

    beforeEach(function() {
      createDatasource({url: 'http://es.com', index: 'test', jsonData: {esVersion: '5'}});

      ctx.backendSrv.datasourceRequest = function(options) {
        requestOptions = options;
        return ctx.$q.when({
            data: {
                responses: [{aggregations: {"1": [{buckets: {text: 'test', value: '1'}}]}}]
            }
        });
      };

      ctx.ds.metricFindQuery('{"find": "terms", "field": "test"}');
      ctx.$rootScope.$apply();

      parts = requestOptions.data.split('\n');
      header = angular.fromJson(parts[0]);
      body = angular.fromJson(parts[1]);
    });
开发者ID:lpic10,项目名称:grafana,代码行数:19,代码来源:datasource_specs.ts

示例4: constructor

 constructor(){
     let _token = window.localStorage.getItem("_token");
     let userInfo = angular.fromJson(window.localStorage.getItem("userInfo"));
     if( ! this.isNull(_token)){
         this.reqHead = new reqHead(_token,userInfo.type,userInfo.id);
     }else{
         this.reqHead = new reqHead("","1","0");
     }
     this.reqBody = {};
 }
开发者ID:zhousw,项目名称:lgappIonic,代码行数:10,代码来源:requestData.ts

示例5: beforeEach

    beforeEach(function() {
      createDatasource({
        url: 'http://es.com',
        index: 'test',
        jsonData: { esVersion: '5' },
      });

      ctx.backendSrv.datasourceRequest = function(options) {
        requestOptions = options;
        return ctx.$q.when({
          data: {
            responses: [
              {
                aggregations: {
                  '1': {
                    buckets: [
                      { doc_count: 1, key: 'test' },
                      {
                        doc_count: 2,
                        key: 'test2',
                        key_as_string: 'test2_as_string',
                      },
                    ],
                  },
                },
              },
            ],
          },
        });
      };

      ctx.ds.metricFindQuery('{"find": "terms", "field": "test"}').then(res => {
        results = res;
      });

      ctx.$rootScope.$apply();

      parts = requestOptions.data.split('\n');
      header = angular.fromJson(parts[0]);
      body = angular.fromJson(parts[1]);
    });
开发者ID:GPegel,项目名称:grafana,代码行数:41,代码来源:datasource_specs.ts

示例6: function

        link: function ($scope:any, element:any, attrs:any) {
            element.addClass('nifi-property-input layout-padding-top-bottom')
            if($scope.property.formKey == null) {
                var formKey = $scope.property.key.split(' ').join('_')+$scope.property.processorName.split(' ').join('_')
                $scope.property.formKey = formKey.toLowerCase();
            }
            if($scope.propertyDisabled == undefined){
                $scope.propertyDisabled = false;
            }

            $scope.onPropertyChanged = function(){
                if($scope.onPropertyChange != undefined){
                    $scope.onPropertyChange($scope.property);
                }
            }

            if( $scope.property.renderType == 'select' && $scope.property.value != null) {
                if($scope.onPropertyChange != undefined){
                    $scope.onPropertyChange($scope.property);
                }
            }

            if( $scope.property.renderType == 'select'){
                if($scope.property.renderOptions == null || $scope.property.renderOptions == undefined){
                    $scope.property.renderOptions ={};
                }
                if($scope.property.renderOptions['selectCustom'] == 'true' ) {
                    if($scope.property.renderOptions['selectOptions']){
                        $scope.property.selectOptions = angular.fromJson($scope.property.renderOptions['selectOptions']);
                    }
                    else {
                        $scope.property.selectOptions = [];
                    }
                }
            }


            if( $scope.property.renderType == 'checkbox-custom' ) {
                if($scope.property.renderOptions == null || $scope.property.renderOptions == undefined){
                    $scope.property.renderOptions ={};
                }
                var trueValue =  $scope.property.renderOptions['trueValue'];
                if(StringUtils.isBlank(trueValue)){
                    $scope.property.renderOptions['trueValue'] = 'true';
                }
                var falseValue =  $scope.property.renderOptions['falseValue'];
                if(StringUtils.isBlank(falseValue)){
                    $scope.property.renderOptions['falseValue'] = 'false';
                }
            }
        }
开发者ID:prashanthc97,项目名称:kylo,代码行数:51,代码来源:nifi-property-input.ts

示例7: parseData

 /**
  * 替换字符串数据中的null,默认替换为0.00,
  * @param data 原数据
  * @param type 类型:1-empty 则替换为空字符串
  */
  public parseData (data,type?){
      let resultData = angular.fromJson(data);
      for (let key in resultData) {
       let value = resultData[key];
           if(value == "null"){
               if(type != "empty"){
                  resultData[key] = "0.00";
               }else{
                  resultData[key] = "";
               }
           }
      }
     return resultData;
   }
开发者ID:zhousw,项目名称:lgappIonic,代码行数:19,代码来源:commonUtil.ts

示例8: ganttDebounce

  let listenRowJson = ganttDebounce(function (rowJson) {
    if (rowJson !== undefined) {
      let row = angular.fromJson(rowJson)
      objectModel.cleanRow(row)
      let tasks = row.tasks

      delete row.tasks
      delete row.drawTask

      let rowModel = $scope.live.row

      angular.merge(rowModel, row)

      let newTasks = {}
      let i
      let l

      if (tasks !== undefined) {
        for (i = 0, l = tasks.length; i < l; i++) {
          objectModel.cleanTask(tasks[i])
        }

        for (i = 0, l = tasks.length; i < l; i++) {
          newTasks[tasks[i].id] = tasks[i]
        }

        if (rowModel.tasks === undefined) {
          rowModel.tasks = []
        }
        for (i = rowModel.tasks.length - 1; i >= 0; i--) {
          let existingTask = rowModel.tasks[i]
          let newTask = newTasks[existingTask.id]
          if (newTask === undefined) {
            rowModel.tasks.splice(i, 1)
          } else {
            objectModel.cleanTask(newTask)
            angular.merge(existingTask, newTask)
            delete newTasks[existingTask.id]
          }
        }
      } else {
        delete rowModel.tasks
      }

      angular.forEach(newTasks, function (newTask) {
        rowModel.tasks.push(newTask)
      })
    }
  }, debounceValue)
开发者ID:angular-gantt,项目名称:angular-gantt,代码行数:49,代码来源:demo.controller.ts

示例9: beforeEach

    beforeEach(async () => {
      createDatasource({
        url: 'http://es.com',
        index: '[asd-]YYYY.MM.DD',
        jsonData: { interval: 'Daily', esVersion: '2' },
      });

      ctx.backendSrv.datasourceRequest = jest.fn(options => {
        requestOptions = options;
        return Promise.resolve({
          data: {
            responses: [
              {
                aggregations: {
                  '1': {
                    buckets: [
                      {
                        doc_count: 10,
                        key: 1000,
                      },
                    ],
                  },
                },
              },
            ],
          },
        });
      });

      query = {
        range: {
          from: toUtc([2015, 4, 30, 10]),
          to: toUtc([2015, 5, 1, 10]),
        },
        targets: [
          {
            alias: '$varAlias',
            bucketAggs: [{ type: 'date_histogram', field: '@timestamp', id: '1' }],
            metrics: [{ type: 'count', id: '1' }],
            query: 'escape\\:test',
          },
        ],
      };

      result = await ctx.ds.query(query);

      parts = requestOptions.data.split('\n');
      header = angular.fromJson(parts[0]);
    });
开发者ID:grafana,项目名称:grafana,代码行数:49,代码来源:datasource.test.ts

示例10: metricFindQuery

  metricFindQuery(query) {
    query = angular.fromJson(query);
    if (!query) {
      return this.$q.when([]);
    }

    if (query.find === 'fields') {
      query.field = this.templateSrv.replace(query.field, {}, 'lucene');
      return this.getFields(query);
    }

    if (query.find === 'terms') {
      query.query = this.templateSrv.replace(query.query || '*', {}, 'lucene');
      return this.getTerms(query);
    }
  }
开发者ID:connection-reset,项目名称:grafana,代码行数:16,代码来源:datasource.ts


注:本文中的angular.fromJson函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。