user379888
user379888

Reputation:

Display Hello, Angular! in Angular JS

I have written the following program to print Hello, Angular! but it does not work. Please guide.

<!DOCTYPE html>
<html ng-app="gemStore"  ng-init="person={text:'Hello, Angular!'>
  <head>
    <link rel="stylesheet" type="text/css" href="bootstrap.min.css" />
    <script type="text/javascript" src="angular.min.js"></script>
    <script type="text/javascript" src="app.js"></script>
  </head>
  <body>
    <h1><div>
    {{person.text}}
  </div></h1>
  </body>
</html>

Upvotes: 1

Views: 61

Answers (4)

Thiago Pires
Thiago Pires

Reputation: 11

You forgot the right bracet and the quote. See the example below.

Upvotes: 0

Kashif Mustafa
Kashif Mustafa

Reputation: 1182

You have typo mistake, replace your code with below.

<!DOCTYPE html>
<html ng-app="gemStore"  ng-init="person={text:'Hello, Angular!'}>
  <head>
    <link rel="stylesheet" type="text/css" href="bootstrap.min.css" />
    <script type="text/javascript" src="angular.min.js"></script>
    <script type="text/javascript" src="app.js"></script>
  </head>
  <body>
    <h1><div>
    {{person.text}}
  </div></h1>
  </body>
</html>

Upvotes: 0

Michel
Michel

Reputation: 28289

Replace :

ng-init="person={text:'Hello, Angular!'>

with:

ng-init="person={text:'Hello, Angular!'}">

Upvotes: 1

TomDoesCode
TomDoesCode

Reputation: 3681

You need a closing brace and quote for the ng-init

ng-init="person={text:'Hello, Angular!'}"

Upvotes: 1

Related Questions