2

This is my first post and I am really new to computer programming so I apologize ahead of my time if my question is super simplistic. So I am trying to start an angular application and I currently have this:

<!DOCTYPE html> <html> <head ng-app> <title>Hello World</title> <body> </head> <h1>{{2+2}}</h1> </body> <script type="<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"> </script> </head> 

What is supposed to happen is that when I click the html page there should be the number 4 pop up but instead this pops up: {{2+2}}. I am assuming that my angular code is not correctly linked but I am not sure. Do you have any ideas?

1
  • 2
    You have <script type=" at the beginning of an otherwise valid script tag. Before continuing with JavaScript, make sure you know the very basics of HTML. Your head and body tags are also whacked (lack of a better term). After you can write a proper HTML document, then learn the basics of JavaScript without a library or framework, then mess around with Angular. You will do much better that way. Commented Oct 19, 2015 at 3:36

2 Answers 2

2

Please find below the corrected html:

<!DOCTYPE html> <html> <head> <title>Hello World</title> </head> <body ng-app> <h1>{{2+2}}</h1> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script> </body> </html> 

Place the <body> tag in correct place. Moved the ng-app to body tag. Place the corrected script tag within <body>

Working sample: http://plnkr.co/edit/T15fetn913Fwn2uJ5pcj?p=preview

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

Comments

0

Explanation: The body of an html page is where the components that display on a page will be declared.

- Overlying declaration of html -where you put meta data, scrip imports, css imports, and title. Basically things the page will use - all other tags from anchors to spans, things the user sees Note*** nothing can go in between these tags

Visit w3schools for a great tutorial on this... http://www.w3schools.com/html/default.asp

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.