本文整理汇总了TypeScript中angular.toJson函数的典型用法代码示例。如果您正苦于以下问题:TypeScript toJson函数的具体用法?TypeScript toJson怎么用?TypeScript toJson使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toJson函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it('calls back with tribes on success', async function () {
const expectedTribes = [{
_id: 'one'
}, {
_id: 'two'
}];
const getSpy = spyOn(axios, 'get')
.and.returnValue(Bluebird.resolve({data: expectedTribes}));
const resultTribes = await Coupling.getTribes();
expect(getSpy).toHaveBeenCalledWith('/api/tribes');
expect(angular.toJson(resultTribes)).toEqual(angular.toJson(expectedTribes));
});
开发者ID:robertfmurdock,项目名称:Coupling,代码行数:14,代码来源:services.spec.ts
示例2: set
set(title, text, severity, timeout) {
var newAlert = {
title: title || '',
text: text || '',
severity: severity || 'info',
};
var newAlertJson = angular.toJson(newAlert);
// remove same alert if it already exists
_.remove(this.list, function(value) {
return angular.toJson(value) === newAlertJson;
});
this.list.push(newAlert);
if (timeout > 0) {
this.$timeout(() => {
this.list = _.without(this.list, newAlert);
}, timeout);
}
if (!this.$rootScope.$$phase) {
this.$rootScope.$digest();
}
return(newAlert);
}
开发者ID:MasayukiKiyota,项目名称:grafana,代码行数:27,代码来源:alert_srv.ts
示例3: constructor
constructor (
private $mdDialog: ng.material.IDialogService,
private $scope: any,
private $rootScope: ng.IRootScopeService,
private $state: StateService,
private ApiService,
private NotificationService,
private resolvedEvents,
private $timeout
) {
'ngInject';
this.api = JSON.parse(angular.toJson(_.cloneDeep(this.$scope.$parent.apiCtrl.api)));
this.events = resolvedEvents.data;
this.eventsSelected = [];
this.eventsTimeline = [];
this.eventsToCompare = [];
this.eventSelected = {};
this.diffMode = false;
this.eventToCompareRequired = false;
this.eventTypes = "PUBLISH_API";
this.cleanAPI(this.api);
this.init();
this.initTimeline(this.events);
}
开发者ID:gravitee-io,项目名称:gravitee-management-webui,代码行数:25,代码来源:apiHistory.controller.ts
示例4: wechatPay
private wechatPay(prepayid){
let appid="wxd585ab5057bdc266";
let noncestr = this.commonUtil.randomString(32);
let timestamp = Math.round(new Date().getTime()/1000).toString();//时间戳 单位需要为秒(10位数字)
let temp="appid="+appid+"&partnerid=1505050301&prepayid="+prepayid+"&package=Sign=WXPay&noncestr="+noncestr+"×tamp="+timestamp+"";
let signTemp = temp+"&key=zjlgwlapipasswordaaaaaaaaaaaaaaa" //商户平台设置的密钥key
alert("noncestr:"+noncestr.length)
let sign = Md5.hashStr(signTemp).toString().toUpperCase() //MD5签名方式
let params = {
appid : appid,
partnerid: '1505050301',
prepayid: prepayid,
package:'Sign=WXPay',
noncestr: noncestr,
timestamp: timestamp,
sign: sign,
};
console.log(params)
alert(angular.toJson(params))
this.wechat.sendPaymentRequest(params).then((result)=>{
//支付成功
alert(result)
},(error)=>{
//支付失败
alert(error)
})
}
开发者ID:zhousw,项目名称:lgappIonic,代码行数:31,代码来源:componentUtil.ts
示例5: alert
.then(res=>{
alert(angular.toJson(res))
if(res.retcode == AppConfig.responseCode.successCode){
let resultData = this.commonUtil.parseData(res.retObj)
this.wechatPay(resultData.prepay_id);
}
})
开发者ID:zhousw,项目名称:lgappIonic,代码行数:7,代码来源:componentUtil.ts
示例6: set
set(title, text, severity, timeout) {
if (_.isObject(text)) {
console.log('alert error', text);
if (text.statusText) {
text = `HTTP Error (${text.status}) ${text.statusText}`;
}
}
var newAlert = {
title: title || '',
text: text || '',
severity: severity || 'info',
};
var newAlertJson = angular.toJson(newAlert);
// remove same alert if it already exists
_.remove(this.list, function(value) {
return angular.toJson(value) === newAlertJson;
});
this.list.push(newAlert);
if (timeout > 0) {
this.$timeout(() => {
this.list = _.without(this.list, newAlert);
}, timeout);
}
if (!this.$rootScope.$$phase) {
this.$rootScope.$digest();
}
return(newAlert);
}
开发者ID:joelanford,项目名称:grafana,代码行数:34,代码来源:alert_srv.ts
示例7: getQueryHeader
getQueryHeader(searchType, timeFrom, timeTo) {
return angular.toJson({
search_type: searchType,
"ignore_unavailable": true,
index: this.indexPattern.getIndexList(timeFrom, timeTo),
});
}
开发者ID:connection-reset,项目名称:grafana,代码行数:7,代码来源:datasource.ts
示例8: getTerms
getTerms(queryDef) {
const range = this.timeSrv.timeRange();
const searchType = this.esVersion >= 5 ? 'query_then_fetch' : 'count';
const header = this.getQueryHeader(searchType, range.from, range.to);
let esQuery = angular.toJson(this.queryBuilder.getTermsQuery(queryDef));
esQuery = esQuery.replace(/\$timeFrom/g, range.from.valueOf());
esQuery = esQuery.replace(/\$timeTo/g, range.to.valueOf());
esQuery = header + '\n' + esQuery + '\n';
const url = this.getMultiSearchUrl();
return this.post(url, esQuery).then(res => {
if (!res.responses[0].aggregations) {
return [];
}
const buckets = res.responses[0].aggregations['1'].buckets;
return _.map(buckets, bucket => {
return {
text: bucket.key_as_string || bucket.key,
value: bucket.key,
};
});
});
}
开发者ID:grafana,项目名称:grafana,代码行数:26,代码来源:datasource.ts
示例9: hasChanges
hasChanges() {
let current = this.cleanDashboardFromIgnoredChanges(this.current.getSaveModelClone());
let original = this.cleanDashboardFromIgnoredChanges(this.original);
var currentTimepicker = _.find(current.nav, { type: 'timepicker' });
var originalTimepicker = _.find(original.nav, { type: 'timepicker' });
if (currentTimepicker && originalTimepicker) {
currentTimepicker.now = originalTimepicker.now;
}
var currentJson = angular.toJson(current, true);
var originalJson = angular.toJson(original, true);
return currentJson !== originalJson;
}
开发者ID:cboggs,项目名称:grafana,代码行数:16,代码来源:change_tracker.ts
示例10: function
return function(arr) {
if (_.isObject(arr) && !_.isArray(arr)) {
return angular.toJson(arr);
} else {
return _.isNull(arr) ? null : arr.toString();
}
};
开发者ID:GPegel,项目名称:grafana,代码行数:7,代码来源:filters.ts
注:本文中的angular.toJson函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论