本文整理汇总了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;
});
示例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
//.........这里部分代码省略.........
示例3: copy
finalItems[type.toLowerCase()] = items.map((i) => {
const copiedItem = copy(i);
copiedItem.equipped = false;
return copiedItem;
});
示例4: calculateFakeIds
res => {
arviointiasteikot = res;
calculateFakeIds();
$scope.arviointiasteikot = angular.copy(arviointiasteikot);
Notifikaatiot.onnistui("arviointiasteikkojen-päivitys-onnistui");
},
示例5: duplicateQuery
duplicateQuery() {
const clone = angular.copy(this.target);
this.panelCtrl.addQuery(clone);
}
示例6: function
get: function(){
return publicConfig = publicConfig || ng1.copy(config);
},
示例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()}}')
}
示例8: beforeEach
beforeEach((): Security => (security = angular.copy(securityIndexController.securities[1])));
示例9: saveCurrentPairAssignments
async saveCurrentPairAssignments(pairAssignments: common.PairAssignmentSet, tribeId: String) {
const response = await axios.post(`/api/${tribeId}/history`, angular.copy(pairAssignments));
return response.data;
}