Привет, ребята. Я новичок в Angular. js, и я учусь в Linkedin Learning, я пытаюсь разработать форму с Angular. Все работало нормально, но когда я начал добавлять страницу приложения. js, я получаю сообщение об ошибке: [$ parse: lexerr:
var myApp = angular.module('myApp', []);
myApp.controller('RegistrationController' , ['$scope',
function($scope) {
$scope.register = function () {
$scope.message = "Benvenuto " + $scope.user.firstname;
};
}]);
Код html следующее, но я думаю, что я все сделал правильно:
...
<link href="https://fonts.googleapis.com/css?family=Lato:400,100,700,900" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.9/angular.min.js"></script>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<script src="js/app.js"></script>
</head>
<body>
<div class="container">
<div class="page">
<!-- only this section is controlled by AngularJS -->
<section class="card register" ng-app="myApp" ng-controller="RegistrationController">
<form name="myform" ng-submit="register()" novalidate>
<div class="textintro">
<h1>Form Validation</h1>
<p>Compila il seguente form</p>
<p ng-show="message">{{ message }}</p>
</div>
<!-- attributi Angular per i campi: ng-required, ng-minlength, ng-maxlength ed ng-pattern (pattern validation) -->
<fieldset>
<input type="text" name="firstname" placeholder="Nome" ng-model="user.firstname" ng-required="true" />
<p class="error validationerror" ng-show="myform.firstname.$invalid && myform.firstname.$touched">Devi inserire il tuo nome</p>
<input type="text" name="lastname" placeholder="Cognome" ng-model="user.lastname" ng-required="true"/>
<p class="error validationerror" ng-show="myform.lastname.$invalid && myform.lastname.$touched">Devi inserire il tuo cognome</p>
<input type="email" name="email" placeholder="Email" ng-model="user.email" />
<p class="error validationerror" ng-show="myform.lastname.$invalid && myform.lastname.$touched">Devi inserire una email valida</p>
<input type="password" name="password" placeholder="Password" ng-model="user.password" ng-minlength="6" />
<p class="error validationerror" ng-show="myform.password.$invalid && myform.password.$touched">La password deve avere almeno 6 caratteri</p>
</fieldset>
<button type="submit" class="btn">Invia</button>
</form>
</section>
</div>
....
Спасибо за всех, кто поможет мне найти ошибку и, если сможет, объяснит мне, что означает эта ошибка.