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


TypeScript change_detection.Parser類代碼示例

本文整理匯總了TypeScript中angular2/src/change_detection/change_detection.Parser的典型用法代碼示例。如果您正苦於以下問題:TypeScript Parser類的具體用法?TypeScript Parser怎麽用?TypeScript Parser使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Parser類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: dashCaseToCamelCase

 _bindEvent(name, expression, current: CompileElement, newAttrs) {
   current.bindElement().bindEvent(
       dashCaseToCamelCase(name),
       this._parser.parseAction(expression, current.elementDescription));
   // Don't detect directives for event names for now,
   // so don't add the event name to the CompileElement.attrs
 }
開發者ID:goderbauer,項目名稱:angular,代碼行數:7,代碼來源:property_binding_parser.ts

示例2: if

 _parseTemplateBindings(templateBindings: string, compileElement: CompileElement) {
   var bindings =
       this._parser.parseTemplateBindings(templateBindings, compileElement.elementDescription);
   for (var i = 0; i < bindings.length; i++) {
     var binding = bindings[i];
     if (binding.keyIsVar) {
       compileElement.bindElement().bindVariable(dashCaseToCamelCase(binding.key), binding.name);
       compileElement.attrs().set(binding.key, binding.name);
     } else if (isPresent(binding.expression)) {
       compileElement.bindElement().bindProperty(dashCaseToCamelCase(binding.key),
                                                 binding.expression);
       compileElement.attrs().set(binding.key, binding.expression.source);
     } else {
       DOM.setAttribute(compileElement.element, binding.key, '');
     }
   }
 }
開發者ID:KenWilliamson,項目名稱:Angular2HostedMobileApp,代碼行數:17,代碼來源:view_splitter.ts

示例3: if

    MapWrapper.forEach(attrs, (attrValue, attrName) => {

      attrName = this._normalizeAttributeName(attrName);

      var bindParts = RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName);
      if (isPresent(bindParts)) {
        if (isPresent(bindParts[1])) {  // match: bind-prop
          this._bindProperty(bindParts[6], attrValue, current, newAttrs);

        } else if (isPresent(
                       bindParts[2])) {  // match: var-name / var-name="iden" / #name / #name="iden"
          var identifier = bindParts[6];
          var value = attrValue == '' ? '\$implicit' : attrValue;
          this._bindVariable(identifier, value, current, newAttrs);

        } else if (isPresent(bindParts[3])) {  // match: on-event
          this._bindEvent(bindParts[6], attrValue, current, newAttrs);

        } else if (isPresent(bindParts[4])) {  // match: onbubble-event
          this._bindEvent('^' + bindParts[6], attrValue, current, newAttrs);

        } else if (isPresent(bindParts[5])) {  // match: bindon-prop
          this._bindProperty(bindParts[6], attrValue, current, newAttrs);
          this._bindAssignmentEvent(bindParts[6], attrValue, current, newAttrs);

        } else if (isPresent(bindParts[7])) {  // match: [(expr)]
          this._bindProperty(bindParts[7], attrValue, current, newAttrs);
          this._bindAssignmentEvent(bindParts[7], attrValue, current, newAttrs);

        } else if (isPresent(bindParts[8])) {  // match: [expr]
          this._bindProperty(bindParts[8], attrValue, current, newAttrs);

        } else if (isPresent(bindParts[9])) {  // match: (event)
          this._bindEvent(bindParts[9], attrValue, current, newAttrs);
        }
      } else {
        var expr = this._parser.parseInterpolation(attrValue, current.elementDescription);
        if (isPresent(expr)) {
          this._bindPropertyAst(attrName, expr, current, newAttrs);
        }
      }
    });
開發者ID:KenWilliamson,項目名稱:Angular2HostedMobileApp,代碼行數:42,代碼來源:property_binding_parser.ts

示例4:

 _bindProperty(name, expression, current: CompileElement, newAttrs) {
   this._bindPropertyAst(name, this._parser.parseBinding(expression, current.elementDescription),
                         current, newAttrs);
 }
開發者ID:goderbauer,項目名稱:angular,代碼行數:4,代碼來源:property_binding_parser.ts


注:本文中的angular2/src/change_detection/change_detection.Parser類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。