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


TypeScript forms.Control類代碼示例

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


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

示例1: it

        it("should be false after changing the value of the control", () => {
          var c = new Control('value');
          var g = new ControlGroup({"one": c});
          c.updateValue('new value');

          expect(g.pristine).toEqual(false);
        });
開發者ID:codetker,項目名稱:angular,代碼行數:7,代碼來源:model_spec.ts

示例2: it

          it("should be false after changing the value of the control", () => {
            var c = new Control(1);
            var a = new ControlArray([c]);

            c.updateValue('new value');

            expect(a.pristine).toEqual(false);
          });
開發者ID:188799958,項目名稱:angular,代碼行數:8,代碼來源:model_spec.ts

示例3: it

 it("should run the validator when the value changes", () => {
   var a = new ControlArray([]);
   var c = new Control(null, Validators.required);
   a.push(c);
   expect(a.valid).toBe(false);
   c.updateValue("some value");
   expect(a.valid).toBe(true);
   expect(a.errors).toBe(null);
 });
開發者ID:gdi2290,項目名稱:sample-Angular2,代碼行數:9,代碼來源:model_spec.ts

示例4: it

        it("should run the validator with the value changes", () => {
          var c = new Control(null, Validators.required);
          var g = new ControlGroup({"one": c});

          c.updateValue("some value");

          expect(g.valid).toEqual(true);
          expect(g.errors).toEqual(null);
        });
開發者ID:B-Thapa,項目名稱:angular,代碼行數:9,代碼來源:model_spec.ts

示例5: describe

      describe("dirty", () => {
        var c: Control;
        var a: ControlArray;

        beforeEach(() => {
          c = new Control('value');
          a = new ControlArray([c]);
        });

        it("should be false after creating a control", () => { expect(a.dirty).toEqual(false); });

        it("should be false after changing the value of the control", () => {
          c.markAsDirty();

          expect(a.dirty).toEqual(true);
        });
      });
開發者ID:B-Thapa,項目名稱:angular,代碼行數:17,代碼來源:model_spec.ts

示例6: addTodo

  addTodo(event, todo) {
    event.preventDefault(); // prevent native page refresh

    this.todoService.add(todo);
    // update the view/model
    this.todoInput.updateValue('');
  }
開發者ID:EdgarArguelles,項目名稱:angular2-webpack-starter,代碼行數:7,代碼來源:todo.ts


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