angularjs Komponenten erhalten ein Formular innerhalb der Vorlage
so habe ich eine Komponente mit einer Vorlage, die ein Formular enthält.
mycomponent.html:
<div>
<form name="myForm">
<!-- more html code -->
</form>
</div>
Wie kann ich im Komponenten-Controller auf myForm zugreifen? Momentan injiziere ich $ scope, um es daraus zu machen. Oder ist das der einzige Weg, um das Formular zu bekommen?
Edit: Code zur besseren Darstellung in Javascript hinzugefügt
angular.module('example')
.component('myComponent', {
templateUrl: 'mycomponent.html',
controller: function($scope) {
$scope.myForm // This works
this.myForm // undefined, can I access it through the component scope instead of $scope somehow?
}
});