本文整理汇总了TypeScript中angular.ICompileService类的典型用法代码示例。如果您正苦于以下问题:TypeScript ICompileService类的具体用法?TypeScript ICompileService怎么用?TypeScript ICompileService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ICompileService类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe("Meeting Contacts Component", () => {
let component: JQuery, meetingService: MeetingService;
let $controller: IControllerService, $rootScope: IRootScopeService, $compile: ICompileService, $q: IQService;
let $scope: IScope;
beforeEach(() => angular.mock.module(MEETINGS_MODULE));
beforeEach(angular.mock.inject($injector => {
$controller = $injector.get("$controller");
$rootScope = $injector.get("$rootScope");
$compile = $injector.get("$compile");
$q = $injector.get("$q");
meetingService = $injector.get("MeetingService");
$scope = $rootScope.$new(true);
component = angular.element(`<meeting-contacts></meeting-contacts>`);
$compile(component)($scope);
$scope.$digest();
}));
it("should initialise", () => {
expect(component).toBeDefined();
});
});
开发者ID:disco-funk,项目名称:ca-london-angular,代码行数:25,代码来源:meeting-contacts.component.spec.ts
示例2: beforeEach
beforeEach(inject(function ($compile: ICompileService, $q: IQService, NgTableParams: ITableParamsConstructor<IPerson>) {
elm = ng1.element(
'<div>' +
'<table ng-table-dynamic="tableParams with cols">' +
'<tr ng-repeat="user in $data">' +
"<td ng-repeat=\"col in $columns\">{{user[col.field]}}</td>" +
'</tr>' +
'</table>' +
'</div>');
scope.tableParams = new NgTableParams({}, {});
scope.cols = [
{
field: 'name',
title: 'Name'
},
{
field: 'age',
title: 'Age'
},
{
field: 'money',
title: 'Money'
}
];
$compile(elm)(scope);
scope.$digest();
}));
开发者ID:Timeyit,项目名称:main,代码行数:29,代码来源:tableDynamicSpec.spec.ts
示例3:
angular.mock.inject(($rootScope: IRootScopeService, $compile: ICompileService) => {
$element = $compile(`
<div>
<foo bar="bar" ng-if="visible"></foo>
</div>
`)($scope = $rootScope.$new());
});
开发者ID:hshn,项目名称:angular-directive-mocker,代码行数:7,代码来源:index.spec.ts
示例4: it
it('when sorting changes should trigger reload of table', inject(function ($compile: ICompileService) {
var elm = ng1.element(
'<table ng-table="tableParams">' +
'<tr ng-repeat="user in $data"><td title="\'Age\'" sortable="\'age\'">{{user.age}}</td></tr>' +
'</table>');
$compile(elm)(scope);
var params = createNgTableParams<IPerson>();
scope.tableParams = params;
scope.$digest();
(params.settings().getData as jasmine.Spy).calls.reset();
params.sorting()['age'] = 'desc';
scope.$digest();
expect((params.settings().getData as jasmine.Spy).calls.count()).toBe(1);
params.sorting()['age'] = 'asc';
scope.$digest();
expect((params.settings().getData as jasmine.Spy).calls.count()).toBe(2);
// setting the same sort order should not trigger reload
params.sorting({ age: 'asc' });
scope.$digest();
expect((params.settings().getData as jasmine.Spy).calls.count()).toBe(2);
}));
开发者ID:Timeyit,项目名称:main,代码行数:25,代码来源:tableSpec.spec.ts
示例5: beforeEach
beforeEach(inject(function ($compile: ICompileService) {
ageFilter = { age: 'text' };
elm = ng1.element(
'<div>' +
'<script type="text/ng-template" id="ng-table/filters/number.html"><input type="number" name="{{name}}"/></script>' +
'<table ng-table="tableParams">' +
'<tr ng-repeat="user in $data">' +
'<td title="\'Name\'" filter="getFilter($column)">{{user.name}}</td>' +
'<td title="\'Age\'" filter="getFilter($column)">{{user.age}}</td>' +
'</tr>' +
'</table>' +
'</div>');
$compile(elm)(scope);
scope.$digest();
scope.getFilter = function (colDef) {
if (colDef.id === 0) {
return { username: 'text' };
} else if (colDef.id === 1) {
return ageFilter;
} else {
return undefined;
}
};
scope.tableParams = createNgTableParams<IPerson>();
scope.$digest();
}));
开发者ID:Timeyit,项目名称:main,代码行数:30,代码来源:tableSpec.spec.ts
示例6: describe
describe("Meeting District Component", () => {
let component: JQuery, ctrl: MeetingDistrictCtrl, meetingService: MeetingService;
let $controller: IControllerService, $rootScope: IRootScopeService, $compile: ICompileService, $q: IQService;
let $scope: IScope;
beforeEach(() => angular.mock.module(MEETINGS_MODULE));
beforeEach(angular.mock.inject($injector => {
$controller = $injector.get("$controller");
$rootScope = $injector.get("$rootScope");
$compile = $injector.get("$compile");
$q = $injector.get("$q");
meetingService = $injector.get("MeetingService");
$scope = $rootScope.$new(true);
spyOn(meetingService, "getDistricts").and.callFake(() => {
const deferred: IDeferred<Array<IDistrict>> = $q.defer();
deferred.resolve(TestDistricts);
return deferred.promise;
});
component = angular.element(`<meeting-district></meeting-district>`);
$compile(component)($scope);
ctrl = component.controller("meetingDistrict");
$scope.$digest();
}));
it("should initialise", () => {
expect(component).toBeDefined();
});
});
开发者ID:disco-funk,项目名称:ca-london-angular,代码行数:32,代码来源:meeting-district.component.spec.ts
示例7: function
function () {
let $scope = $rootScope.$new()
let ganttApi
let ready = false
$scope.api = function (api) {
ganttApi = api
ganttApi.core.on.ready($scope, function () {
ready = true
})
}
$compile('<div gantt api="api"></div>')($scope)
$scope.$digest()
$timeout.flush()
expect(ganttApi).to.be.not.undefined
expect(ready).to.be.ok
ganttApi = undefined
ready = false
$compile('<div gantt api="api"></div>')($scope)
$scope.$digest()
$timeout.flush()
expect(ganttApi).to.be.not.undefined
expect(ready).to.be.ok
}
开发者ID:angular-gantt,项目名称:angular-gantt,代码行数:30,代码来源:gantt.factory.spec.ts
示例8: function
this.compileDirectiveTemplates = function () {
if (!$element.hasClass('ng-table')) {
$scope.templates = {
header: ($attrs.templateHeader ? $attrs.templateHeader : 'ng-table/header.html'),
pagination: ($attrs.templatePagination ? $attrs.templatePagination : 'ng-table/pager.html')
};
$element.addClass('ng-table');
var headerTemplate: IAugmentedJQuery = null;
// $element.find('> thead').length === 0 doesn't work on jqlite
var theadFound = false;
ng1.forEach($element.children(), function (e) {
if (e.tagName === 'THEAD') {
theadFound = true;
}
});
if (!theadFound) {
headerTemplate = ng1.element('<thead ng-include="templates.header"></thead>', $document);
$element.prepend(headerTemplate);
}
var paginationTemplate = ng1.element(
'<div ng-table-pagination="params" template-url="templates.pagination"></div>',
$document
);
$element.after(paginationTemplate);
if (headerTemplate) {
$compile(headerTemplate)($scope);
}
$compile(paginationTemplate)($scope);
}
};
开发者ID:Timeyit,项目名称:main,代码行数:31,代码来源:ngTableController.ts
示例9: beforeEach
beforeEach(angular.mock.inject($injector => {
$controller = $injector.get("$controller");
$rootScope = $injector.get("$rootScope");
$compile = $injector.get("$compile");
$q = $injector.get("$q");
$scope = $rootScope.$new(true);
downloadsService = $injector.get("DownloadsService");
spyOn(downloadsService, "getDownloads").and.callFake(() => {
const deferred: IDeferred<Array<IDownload>> = $q.defer();
deferred.resolve(TestDownloads);
return deferred.promise;
});
spyOn(downloadsService, "getCategories").and.callFake(() => {
const deferred: IDeferred<Array<ICategory>> = $q.defer();
deferred.resolve(TestCategories);
return deferred.promise;
});
component = angular.element(`<downloads></downloads>`);
$compile(component)($scope);
ctrl = component.controller("downloads");
$scope.$digest();
}));
开发者ID:disco-funk,项目名称:ca-london-angular,代码行数:26,代码来源:downloads.component.spec.ts
示例10: function
function () {
let $scope = $rootScope.$new()
$scope.data = angular.copy(mockData)
let ganttElement = $compile('<div gantt data="data"><gantt-tree></gantt-tree></div>')($scope)
$scope.$digest()
$timeout.flush()
// Set the data in tree view ordering
let orderedData = $scope.data.slice()
let indices = {}
angular.forEach($scope.data, function (rowModel, i) {
if (rowModel.name) {
indices[rowModel.name] = i
}
})
/*jshint sub:true */
let configRow = orderedData[indices['Config']]
let setupRow = orderedData[indices['Setup']]
let serverRow = orderedData[indices['Server']]
orderedData[indices['Setup']] = serverRow
orderedData[indices['Config']] = setupRow
orderedData[indices['Server']] = configRow
/*jshint sub:false */
checkLabels(orderedData, ganttElement)
}
开发者ID:angular-gantt,项目名称:angular-gantt,代码行数:30,代码来源:plugins.spec.ts
注:本文中的angular.ICompileService类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论