0

I am new to angular. I have created a HTML where the user enters anything into the text box, and at the same time it should appear on the screen whatever you have input to the text box.

HTML CODE:

<html ng-app>
<head>
    <title>Hello World - AngularJS</title>
    <script type="text/javascript"
        src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>

</head>
<body>

    Write some text in textbox:
    <input type="text" ng-model="sometext" />

    <h1>Hello {{ sometext }}</h1>

</body>
</html>
6
  • you forget ng-controller Commented Aug 3, 2015 at 17:21
  • 3
    Your code is working perfectly..see this fiddle Commented Aug 3, 2015 at 17:23
  • 1
    please check your browser console for errors.. Commented Aug 3, 2015 at 17:24
  • and also check angular version Commented Aug 3, 2015 at 17:31
  • @Grundy I dont think he has to do a recheck in his angular version as I used the same version as his in the fiddle and it worked well.. Commented Aug 3, 2015 at 17:39

1 Answer 1

1

Completely write out the source

<head>
    <title>Hello World - AngularJS</title>
    <script type="text/javascript"
        src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>

</head>
Sign up to request clarification or add additional context in comments.

2 Comments

That is not actually needed..what the OP has done is enough..It works really well.
Aye; if he's running the file with the file://-protocol, it will not be able to resolve file://ajax.googleapis.com[...] and nothing will work. @Lal if OP is opening the HTML-file in a web browser (and not running a web-server). It will not work with just //ajax.googleapis.com[...]...

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.