I am trying to put form validation but I am getting form element is undefined. If I remove app-root element from index.html, it starts working as per expectation.
<!doctype html>
<html lang="en" ng-app>
<head>
<meta charset="utf-8">
<title>NKZ Technologies</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="script" src="../node_modules/angular/angular.min.js">
</script>
</head>
<body>
<form name="myForm">
Valid = {{myForm.$valid}}
̶<̶/̶f̶o̶r̶m̶>̶
<app-root></app-root>
</form>
</body>
</html>
Thanks, Ankit
@georgeawg your suggestion works for me but only in index.html
.
Now app-root
element renders app.component
. I am having same form undefine
issue in app.component.html.
<div id="main-content">
<form name="test">
a = {{test.$valid}}
</form>
</div>