当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ICompileService.default方法代码示例

本文整理汇总了TypeScript中angular.ICompileService.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ICompileService.default方法的具体用法?TypeScript ICompileService.default怎么用?TypeScript ICompileService.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular.ICompileService的用法示例。


在下文中一共展示了ICompileService.default方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5:

 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

示例6: 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

示例7: 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

示例8: 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

示例9: getCustomClass

        beforeEach(inject(function ($compile: ICompileService, $q: IQService, NgTableParams: ITableParamsConstructor<any>) {
            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>');

            function getCustomClass(context: ColumnFieldContext) {
                if (context.$column.title().indexOf('Money') !== -1) {
                    return 'moneyHeaderClass';
                } else {
                    return 'customClass';
                }
            }

            function money(context: ColumnFieldContext) {
                let selectOptions = [{
                    'id': 10,
                    'title': '10'
                }];
                return $q.when(selectOptions);
            }

            scope.tableParams = new NgTableParams({}, {});
            scope.cols = [
                {
                    'class': getCustomClass,
                    field: 'name',
                    filter: { ['name']: 'text' },
                    headerTitle: 'Sort by Name',
                    sortable: 'name',
                    show: true,
                    title: 'Name of person'
                },
                {
                    'class': getCustomClass,
                    field: 'age',
                    headerTitle: 'Sort by Age',
                    sortable: 'age',
                    show: true,
                    title: 'Age'
                },
                {
                    'class': getCustomClass,
                    field: 'money',
                    filter: { ['action']: 'select' },
                    headerTitle: 'Sort by Money',
                    filterData: money,
                    show: true,
                    title: 'Money'
                }
            ];

            $compile(elm)(scope);
            scope.$digest();
        }));
开发者ID:Timeyit,项目名称:main,代码行数:59,代码来源:tableDynamicSpec.spec.ts


注:本文中的angular.ICompileService.default方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。