JSFiddle - React, Tailwind, and code Playground
HTML
<p><em>Check the console</em></p>
<div ng-app="myApp">
<div ng-form="theForm" my-form>
<my-input></my-input>
</div>
</div>
JavaScript
var app = angular.module('myApp', []);
app.directive('myForm', function() {
return {
restrict: 'A',
scope: {
myFormName: '@ngForm'
},
controller: ['$scope', function($scope) {
this.getForm = function() {
return $scope[$scope.myFormName];
}
}]
}
});
app.directive('myInput', function() {
return {
restrict: 'E',
require: '^myForm',
template: '<span>Hello World</span>',
link: function(scope, element, attrs, myForm) {
console.log(myForm.getForm());
}
};
});