本文整理汇总了TypeScript中angular.IParseService类的典型用法代码示例。如果您正苦于以下问题:TypeScript IParseService类的具体用法?TypeScript IParseService怎么用?TypeScript IParseService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IParseService类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: linkFn
function linkFn($scope: TableScope<T>, $element: IAugmentedJQuery, $attrs: InputAttributes){
const setter = $parse($attrs.ngTableColumnsBinding).assign;
if (setter){
$scope.$watch<ColumnDef[]>('$columns', newColumns => {
const shallowClone = (newColumns || []).slice(0);
setter($scope, shallowClone);
});
}
}
开发者ID:QuBaR,项目名称:ng-table,代码行数:9,代码来源:ngTableColumnsBinding.directive.ts
示例2: function
(getter as any).assign = function($scope: ColumnFieldContext, value: any){
var parsedExpr = $parse(expr);
if (parsedExpr.assign) {
// we should be writing back to the parent scope as this is where the expression
// came from
parsedExpr.assign($scope.$parent, value);
} else {
localValue = value;
}
};
开发者ID:Timeyit,项目名称:main,代码行数:10,代码来源:ngTable.directive.ts
示例3: setupGroupRowBindingsToInternalScope
function setupGroupRowBindingsToInternalScope() {
$scope.$groupRow = { show: false };
if ($attrs.showGroup) {
var showGroupGetter = $parse($attrs.showGroup);
$scope.$parent.$watch<boolean>(showGroupGetter, function (value) {
$scope.$groupRow.show = value;
});
if (showGroupGetter.assign) {
// setup two-way databinding thus allowing ngTableGrowRow to assign to the showGroup expression
$scope.$watch<boolean>('$groupRow.show', function (value) {
showGroupGetter.assign($scope.$parent, value);
});
}
} else {
$scope.$watch<boolean>('params.hasGroup()', function (newValue) {
$scope.$groupRow.show = newValue;
});
}
}
开发者ID:Timeyit,项目名称:main,代码行数:19,代码来源:ngTableController.ts
示例4: Error
compile: function (tElement, tAttrs) {
let configExpParsed = $parse(tAttrs.w11kSelectConfig);
let optionsExpParsed = w11kSelectHelper.parseOptions(tAttrs.w11kSelectOptions);
let ngModelSetter = $parse(tAttrs.ngModel).assign;
let assignValueFn = optionsExpParsed.value.assign;
if (optionsExpParsed.tracking !== undefined && assignValueFn === undefined) {
throw new Error('value part of w11kSelectOptions expression must be assignable if \'track by\' is used');
}
return function (scope: Scope, iElement: any, iAttrs: any, controller: any) {
let domElement = iElement[0];
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* internal model
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
let optionsAlreadyRead: IPromise<void>;
let ngModelAlreadyRead: boolean = false;
let hasBeenOpened = false;
let internalOptions: InternalOption[] = [];
let internalOptionsMap = {};
let optionsFiltered: InternalOption[] = [];
scope.options = {
visible: []
};
scope.filter = {
values: {}
};
scope.config = angular.copy(w11kSelectConfig.instance);
// marker to read some parts of the config only once
let configRead = false;
scope.$watch(
function () {
return configExpParsed(scope.$parent);
},
function (newConfig) {
if (angular.isArray(newConfig)) {
w11kSelectHelper.extendDeep.apply(w11kSelectHelper, [scope.config].concat(newConfig));
applyConfig();
} else if (angular.isObject(newConfig)) {
w11kSelectHelper.extendDeep(scope.config, newConfig);
applyConfig();
}
},
true
);
function applyConfig () {
optionsAlreadyRead.then(function () {
checkSelection();
updateNgModel();
checkConfig(scope.config, setViewValue);
controller.$validate();
});
if (!configRead) {
updateStaticTexts();
configRead = true;
}
}
function updateStaticTexts () {
if (scope.config.filter.select.active && scope.config.filter.select.text !== null && typeof(scope.config.filter.select.text) !== 'undefined') {
let selectFilteredButton = domElement.querySelector('.select-filtered-text');
selectFilteredButton.textContent = scope.config.filter.select.text;
}
if (scope.config.filter.deselect.active && scope.config.filter.deselect.text !== null && typeof(scope.config.filter.deselect.text) !== 'undefined') {
let deselectFilteredButton = domElement.querySelector('.deselect-filtered-text');
deselectFilteredButton.textContent = scope.config.filter.deselect.text;
}
if (scope.config.header.placeholder !== null && typeof(scope.config.header.placeholder) !== 'undefined') {
let headerPlaceholder = domElement.querySelector('.header-placeholder');
headerPlaceholder.textContent = scope.config.header.placeholder;
}
}
function checkSelection () {
if (scope.config.multiple === false) {
let selectedOptions: InternalOption[] = internalOptions.filter(
(option) => option.state === OptionState.selected
);
if (selectedOptions.length > 0) {
setSelected(selectedOptions, false);
selectedOptions[0].state = OptionState.selected;
}
}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//.........这里部分代码省略.........
开发者ID:w11k,项目名称:w11k-select,代码行数:101,代码来源:w11k-select.directive.ts
示例5:
const getter = (context: ColumnFieldContext) => {
if (localValue !== undefined){
return localValue as T;
}
return $parse(expr)(context) as T;
};
开发者ID:QuBaR,项目名称:ng-table,代码行数:6,代码来源:ngTable.directive.ts
注:本文中的angular.IParseService类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论