Madhu G Nadig
Madhu G Nadig

Reputation: 122

Very simple Angularjs code not working,

I started out angularjs this morning. I got the right result in the morning. But for some reason, this very simple angularjs code doesn't work anymore.

<html ng-app = "jajc">
  <head>
  <title>TESTER</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js"></script>
</head>
<body>
<form id="searchthis" action="/search" style="display:inline;" method="get">
<input id="ser" name="q" size="80" type="text" ng-model = "name"     placeholder="Enter a place "/>
        <input id="sub" value="Search" type="submit"/>
        <p>Welcome {{name}}</p>
  </form>
 </body>
</html>

Upvotes: 0

Views: 85

Answers (3)

maddygoround
maddygoround

Reputation: 2280

It is just because you have named the app as "jajc" and you have not created any angular module with the same name.

Simply remove the "jajc" and keep your <html> tag as <html ng-app>will do the job.

Upvotes: 0

Manoj Shevate
Manoj Shevate

Reputation: 742

Angular searches for module Jajc and failed to load as you havent written any code to register this module. instead just write ng-app in html tag and remove the name. refer below code -

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app>
<form id="searchthis" action="/search" style="display:inline;" method="get">
<input id="ser" name="q" size="80" type="text" ng-model = "name" placeholder="Enter a place "/> </input>
        <input id="sub" value="Search" type="submit"></input>
        <p>Welcome {{name}}</p>
  </form>

</body>

Upvotes: 3

Johan
Johan

Reputation: 118

You should define a ng-controller

Upvotes: 0

Related Questions