3

Just as the title suggests, I'm trying to self learn Angular.js but I run into an unexpected frustrating road block... I can't even get the variables to display properly on the webpage!

<!DOCTYPE html>
<html ng-app>
<head>
    <title>Lets test this out?</title>
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
</head>
<body>

    Write your name in the text box!
    <input type="text" ng-model="sometext" />    
    <h1>Hello {{ sometext }}</h1>

</body>
</html>

I'd greatly appreciate anyone that can tell me what I am doing wrong as I've been beating my head against my desk for an hour and googled this issue but I can't understand why it doesn't work.

2

2 Answers 2

3

Check your angular reference has been loaded properly. Try to add ng-app to your body tag

DEMO

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app>
    Write your name in the text box!
   <input type="text" ng-model="sometext" />
   <h1>Hello {{ sometext }}</h1>
</body>

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

1 Comment

You're right, i ran it through a few online HTML5 situations and it worked, it might be the IDE i'm using (Angular IDE 2017) for some reason its not even rendering the code properly...
0

This is work perfect just you have to remove first tag

´

<html ng-app>
<head>
    <title>Lets test this out?</title>
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js</script>
</head>
<body>

    Write your name in the text box!
    <input type="text" ng-model="sometext" />

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

</body>
</html>

´

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.