manohar e
manohar e

Reputation: 327

Why syntax error is coming in my angularjs project

In my angularJS project I'm getting below error. Can you please help me?

Error

angular.min.js:117Error: [$parse:syntax] http://errors.angularjs.org/1.5.6/$parse/syntax?p0=Shoping&p1=is%20an%20unexpected%20token&p2=8&p3=Online%20Shoping%20-%20login&p4=Shoping%20-%20login at Error (native) at localhost:8082/onlineshopping/angular.min.js:6:412 at Object.s.throwError (localhost:8082/onlineshopping/angular.min.js:228:143) at Object.s.ast (localhost:8082/onlineshopping/angular.min.js:220:47) at Object.td.compile (localhost:8082/onlineshopping/angular.min.js:229:420) at kc.parse (localhost:8082/onlineshopping/angular.min.js:258:213) at g (localhost:8082/onlineshopping/angular.min.js:125:278) at k (localhost:8082/onlineshopping/angular.min.js:105:129) at $ (localhost:8082/onlineshopping/angular.min.js:77:397) at $b (localhost:8082/onlineshopping/angular.min.js:61:398)

My HTML Code

<!DOCTYPE html>
<html>
<head>
<title>Online Shopping - Login Page</title>
<script src="angular.min.js"></script>
<!-- <link rel="stylesheet" href=".\WEB-INF\lib\css\Styles.css"/> -->
</head>
<body ng-app>
    <div style="text-align:center">
        <h1>{{Online Shoping - login}}</h1>
        <form action="login_submit" name="login" method="get">
            Email Address: <input type="email" placeholder="[email protected]" required/><br><br>
            Password: <input type="password" placeholder="password" required/><br><br><br>
            <input type="submit" value="Login"/>
        </form>
    </div>
</body>
</html>

Upvotes: 1

Views: 532

Answers (2)

MANISH KUMAR CHOUDHARY
MANISH KUMAR CHOUDHARY

Reputation: 3482

you just need to update the <h1></h1> tage like

 <h1>Online Shoping - {{login}}</h1>

or you can also use <h1></h1> like

{{'Online Shopping - '+ login}}

for more details click fiddler link here

Upvotes: 1

elclanrs
elclanrs

Reputation: 94101

This is wrong {{Online Shoping - login}} because Online Shoping is not a value nor valid syntax. You can use a string and concatenate the value:

{{'Online Shopping - '+ login}}

Or simply interpolate where needed only:

<h1>Online Shopping - {{login}}</h1>

Upvotes: 0

Related Questions