本文整理汇总了TypeScript中angular.copy函数的典型用法代码示例。如果您正苦于以下问题:TypeScript copy函数的具体用法?TypeScript copy怎么用?TypeScript copy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了copy函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
return query.then($scope.transformToSegments(true)).then(results => {
if (segment.type === 'key') {
results.splice(0, 0, angular.copy($scope.removeDimSegment));
}
return results;
});
开发者ID:grafana,项目名称:grafana,代码行数:6,代码来源:query_parameter_ctrl.ts
示例2: function
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;
}
}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* dropdown
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
let domDropDownMenu = domElement.querySelector('.dropdown-menu');
let domDropDownContent = domElement.querySelector('.dropdown-menu .content');
let domHeightAdjustContainer = w11kSelectHelper.getParent(iElement, '.w11k-select-adjust-height-to');
let domHeaderText = domElement.querySelector('.header-text');
function onEscPressed (event) {
if (event.keyCode === 27) {
if (scope.dropdown.close) { // check is for ts only
//.........这里部分代码省略.........
开发者ID:w11k,项目名称:w11k-select,代码行数:101,代码来源:w11k-select.directive.ts
示例3: copy
finalItems[type.toLowerCase()] = items.map((i) => {
const copiedItem = copy(i);
copiedItem.equipped = false;
return copiedItem;
});
开发者ID:delphiactual,项目名称:DIM,代码行数:5,代码来源:auto-loadouts.ts
示例4: calculateFakeIds
res => {
arviointiasteikot = res;
calculateFakeIds();
$scope.arviointiasteikot = angular.copy(arviointiasteikot);
Notifikaatiot.onnistui("arviointiasteikkojen-päivitys-onnistui");
},
开发者ID:Opetushallitus,项目名称:eperusteet,代码行数:6,代码来源:admin.ts
示例5: duplicateQuery
duplicateQuery() {
const clone = angular.copy(this.target);
this.panelCtrl.addQuery(clone);
}
开发者ID:ArcticSnowman,项目名称:grafana,代码行数:4,代码来源:query_editor_row.ts
示例6: function
get: function(){
return publicConfig = publicConfig || ng1.copy(config);
},
开发者ID:Timeyit,项目名称:main,代码行数:3,代码来源:ngTableFilterConfig.ts
示例7: function
function () {
let $scope = $rootScope.$new()
$scope.data = angular.copy(mockData)
let ganttApi
let ready = false
$scope.api = function (api) {
ganttApi = api
ganttApi.core.on.ready($scope, function () {
ready = true
})
}
let ganttElement = $compile('<div gantt api="api" data="data">' +
'<gantt-tree></gantt-tree>' +
'</div>')($scope)
$scope.$digest()
$timeout.flush()
expect(ganttApi).to.be.not.undefined
expect(ready).to.be.ok
expect(ganttApi.tree.isCollapsed(undefined)).to.be.undefined
// All rows should be expanded on init
angular.forEach(ganttApi.gantt.rowsManager.rows, function (row) {
expect(ganttApi.tree.isCollapsed(row)).to.be.not.ok
})
// Collapse all rows
ganttApi.tree.collapseAll()
$scope.$digest()
// Development row should be collapsed
expect(ganttApi.tree.isCollapsed('development')).to.be.ok
// All rows should be collapsed
angular.forEach(ganttApi.gantt.rowsManager.rows, function (row) {
expect(ganttApi.tree.isCollapsed(row)).to.be.ok
})
// Expand all rows
ganttApi.tree.expandAll()
$scope.$digest()
// All rows should be expanded
angular.forEach(ganttApi.gantt.rowsManager.rows, function (row) {
expect(ganttApi.tree.isCollapsed(row)).to.be.not.ok
})
// GanttTreeNodeController
let treeNodeElement = jQuery(ganttElement).find('[ng-controller="GanttTreeNodeController"]').first()
let ganttTreeNodeController = angular.element(treeNodeElement[0]).scope()
// First row name should be "Milestones"
expect(ganttTreeNodeController.getValue()).to.be.eq('Milestones')
// Collapsing should be disabled - no child rows
expect(ganttTreeNodeController.isCollapseDisabled()).to.be.ok
// Should get row content correctly. If undefined and if defined
expect(ganttTreeNodeController.getRowContent()).to.be.eq('{{row.model.name}}')
// Test row
let testRow = ganttApi.gantt.rowsManager.rows[0]
// Test undefined collapsed
testRow._collapsed = undefined
expect(ganttApi.tree.isCollapsed(testRow)).to.be.not.ok
// Set custom content
testRow.model.content = '> {{row.model.name}}'
expect(ganttTreeNodeController.getRowContent()).to.be.eq('> {{row.model.name}}')
// GanttTreeController
let treeElement = jQuery(ganttElement).find('[ng-controller="GanttTreeController"]')
let ganttTreeController = angular.element(treeElement).scope()
// Get default header
expect(ganttTreeController.getHeader()).to.be.eq('Name')
// Get default header content
expect(ganttTreeController.getHeaderContent()).to.be.eq('{{getHeader()}}')
}
开发者ID:angular-gantt,项目名称:angular-gantt,代码行数:86,代码来源:plugins.spec.ts
示例8: beforeEach
beforeEach((): Security => (security = angular.copy(securityIndexController.securities[1])));
开发者ID:scottohara,项目名称:loot,代码行数:1,代码来源:index.ts
示例9: saveCurrentPairAssignments
async saveCurrentPairAssignments(pairAssignments: common.PairAssignmentSet, tribeId: String) {
const response = await axios.post(`/api/${tribeId}/history`, angular.copy(pairAssignments));
return response.data;
}
开发者ID:robertfmurdock,项目名称:Coupling,代码行数:4,代码来源:services.ts
注:本文中的angular.copy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论