0

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>
9
  • What about it doesn't work? Commented Oct 19, 2015 at 16:38
  • I get Welcome {{name}} on my browser. Commented Oct 19, 2015 at 16:39
  • that generally means that the application crashed along the way or failed to bootstrap or that you're missing a dependency. Also, remove spacing between ng-app and "jajc" those should be connected without spacing. Commented Oct 19, 2015 at 16:39
  • Is there any way this code would have crashed? Commented Oct 19, 2015 at 16:40
  • One thing the puzzles me is that the same code worked in the morning! Commented Oct 19, 2015 at 16:41

3 Answers 3

3

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>

Sign up to request clarification or add additional context in comments.

Comments

0

You should define a ng-controller

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.