當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript angular.IParseService類代碼示例

本文整理匯總了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;未經允許,請勿轉載。