本文整理汇总了TypeScript中angular.isDefined函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isDefined函数的具体用法?TypeScript isDefined怎么用?TypeScript isDefined使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isDefined函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: function
link: function (scope: any, elem: any, attrs: any) {
var scrollSelector = attrs.scrollSelector;
var offset = angular.isDefined(attrs.offset) ? parseInt(attrs.offset) : 0;
var scrollContainerElem = angular.isDefined(scrollSelector) ? angular.element(scrollSelector) : $win;
var currLeftPos = elem[0].offsetLeft;
scrollContainerElem.on('scroll', function (e) {
stickIt();
});
function stickIt() {
var scrollAmount = scrollContainerElem.scrollTop();
elem.css('top', (scrollAmount + offset) + 'px');
elem.css('position', 'absolute');
elem.css('padding-left', '15px')
}
elem.bind("stickIt", function () {
stickIt();
});
scope.$on('$destroy', function () {
elem.unbind("stickIt");
});
}
开发者ID:prashanthc97,项目名称:kylo,代码行数:27,代码来源:sticky.ts
示例2: return
return (str: string, regExStr: string, replaceValue: string) => {
if (!isDefined(regExStr)) {
$log.debug(`Did not supply regex string for 'replace' filter.`);
return str;
} else if (!isDefined(replaceValue)) {
$log.debug(`Did not supply replacement value for 'replace' filter.`);
return str;
} else {
return str.replace(new RegExp(regExStr, 'g'), replaceValue);
}
};
开发者ID:mizzy,项目名称:deck,代码行数:11,代码来源:replace.filter.ts
示例3:
tableOptionInitializerPromise.then((file:any) => {
var serviceName = $scope.tableOption.initializeServiceName;
if(angular.isDefined(serviceName)) {
var svc = $injector.get(serviceName);
if (angular.isDefined(svc) && angular.isFunction(svc.initializeCreateFeed)) {
var createFeedModel = FeedService.createFeedModel;
svc.initializeCreateFeed($scope.tableOption, stepperController, createFeedModel);
}
}
});
开发者ID:prashanthc97,项目名称:kylo,代码行数:11,代码来源:TableOptionsStepperDirective.ts
示例4: update
link: ($scope: any, element: any, attrs: any)=> {
$scope.truncatedFormat = angular.isDefined($scope.truncatedFormat) ? $scope.truncatedFormat : false;
$scope.addAgoSuffix = angular.isDefined($scope.addAgoSuffix) ? $scope.addAgoSuffix : false;
$scope.time = $scope.startTime;
$scope.previousDisplayStr = '';
$scope.$watch('startTime', (newVal: any, oldVal: any)=> {
$scope.time = $scope.startTime;
format();
})
format();
var seconds = 0;
var minutes = 0;
var hours = 0;
var days = 0;
var months = 0;
var years = 0;
if ($scope.refreshTime == undefined) {
$scope.refreshTime = 1000;
}
function update() {
$scope.time += $scope.refreshTime;
//format it
format();
}
function format() {
var ms = $scope.time;
var displayStr = DateTimeUtils($filter('translate')).formatMillisAsText(ms,$scope.truncatedFormat,false);
if($scope.addAgoSuffix) {
displayStr += " ago";
}
if ($scope.previousDisplayStr == '' || $scope.previousDisplayStr != displayStr) {
element.html(displayStr);
element.attr('title', displayStr);
}
$scope.previousDisplayStr = displayStr;
}
var interval = $interval(update, $scope.refreshTime);
var clearInterval = ()=> {
$interval.cancel(interval);
interval = null;
}
$scope.$on('$destroy', ()=> {
clearInterval()
});
}
开发者ID:prashanthc97,项目名称:kylo,代码行数:52,代码来源:kylo-timer.ts
示例5: check
/**
*
* @param permissions array of permissions needed (only 1 is needed)
* @param entity optional entity
*/
function check(permissions: any, entity: any, entityType: any) {
if (angular.isDefined(entity) && angular.isDefined(entityType)) {
validate(accessControlService.hasEntityAccess(permissions, entity,entityType));
}
else {
accessControlService.getUserAllowedActions(accessControlService.ACCESS_MODULES.SERVICES, true)
.then(function (actionSet: any) {
var valid = accessControlService.hasAnyAction(permissions, actionSet.actions);
validate(valid);
}, true);
}
}
开发者ID:prashanthc97,项目名称:kylo,代码行数:19,代码来源:ng-if-permission.ts
示例6: text
this.text = function text(textId: string, projectId?: string): string {
if (angular.isDefined(projectId)) {
return this.project(projectId) + textId;
} else {
return this.project() + textId;
}
};
开发者ID:sillsdev,项目名称:web-scriptureforge,代码行数:7,代码来源:link.service.ts
示例7: setupField
/**
* Sets up and configures properties for a dialog field
* @memberof DialogDataService
* @function setupField
* @param data {any} This is a object that is all the information for a particular dialog field
*
**/
public setupField(data: any) {
let field = _.cloneDeep(data);
const dropDownValues = [];
field.fieldValidation = null;
field.fieldBeingRefreshed = (angular.isDefined(field.fieldBeingRefreshed) ? field.fieldBeingRefreshed : false);
field.errorMessage = '';
if (field.type === 'DialogFieldDropDownList') {
for (let option of field.values) {
if (option[0] === String(field.default_value)) {
field.selected = option;
}
if (field.data_type === 'integer') {
dropDownValues.push([parseInt(option[0], 10), option[1]]);
} else {
dropDownValues.push(option);
}
}
field.values = dropDownValues;
field.values = this.updateFieldSortOrder(field);
}
field.default_value = this.setDefaultValue(field);
return field;
}
开发者ID:karelhala,项目名称:ui-components,代码行数:32,代码来源:dialogData.ts
示例8: function
vm.openColumnsSortPanel = function (value) {
if (angular.isDefined(value))
vm.columnSortPanelOpened = value;
else {
vm.columnSortPanelOpened = !vm.columnSortPanelOpened;
}
}
开发者ID:izenda,项目名称:resources,代码行数:7,代码来源:instant-report-data-source-controller.ts
示例9: setDefaultValue
/**
*
* This method sets default value for a dialog field
* @memberof DialogDataService
* @function setDefaultValue
* @param data {any} This is a object that is all the information for a particular dialog field
*
**/
private setDefaultValue(data): any {
let defaultValue: any = '';
const firstOption = 0; // these are meant to help make code more readable
const fieldValue = 0;
if (_.isObject(data.values)) {
if (angular.isDefined(data.default_value) && data.default_value !== null) {
defaultValue = data.default_value;
} else {
defaultValue = data.values[firstOption][fieldValue];
}
} else {
if (data.type === 'DialogFieldDateControl' || data.type === 'DialogFieldDateTimeControl') {
defaultValue = new Date(data.values);
} else {
defaultValue = data.values;
}
}
if (data.default_value) {
defaultValue = data.default_value;
}
if (data.data_type === 'integer') {
defaultValue = parseInt(data.default_value, 10);
}
return defaultValue;
}
开发者ID:karelhala,项目名称:ui-components,代码行数:35,代码来源:dialogData.ts
示例10: project
this.project = function project(projectId?: string, projectType: string = 'sfchecks'): string {
if (angular.isDefined(projectId)) {
return '/app/' + projectType + '/' + projectId + '#!/';
} else {
return '#!/';
}
};
开发者ID:sillsdev,项目名称:web-scriptureforge,代码行数:7,代码来源:link.service.ts
注:本文中的angular.isDefined函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论