Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

FormController: attach to component controller? #13991

Closed
@royaldark

Description

@royaldark

The new component support in 1.5 is great, but it seems to interact badly with FormController. With a very simple component like such:

someModule.component('customComponent', {
  template: '<form name="$ctrl.form">Is form valid? {{ $ctrl.form.$valid }}</form>',
  controller: ['$scope', function($scope) {
    this.$onInit = function() {
      console.log("FormController:");
      console.log(this.form);
    };
  }]
});

all seems well on-screen, as it will correctly show Is form valid? true. However, the console.log in the customComponent controller can't find the FormController that should be bound to it via name="$ctrl.form". I also checked $scope.form and $scope.$ctrl.form to make sure it wasn't a this-binding issue, but no luck.

Here is a Plunker showing the issue in action: http://plnkr.co/edit/P8gKwz6koHeoXRHdhoGl

Am I missing something obvious?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions