2

Here is firstAngularJSApp.html

<html ng-app="store"><!-- "ng-app" creates and angular app by running the module. because of ng-app html inside of this tag will be treated as part of angular app --> 
<head>
    <link rel="stylesheet" type="text/css" href="bootstrap.min.css"/>
    <script type="text/javascript" src="angular.min.js"></script>
    <script type="text/javascript" src="app.js"/>
</head>
<body>

<p>I am {{ 4+6 }}</p>

</body>
</html>

Here is app.js

var app = angular.module('store',[]); 

When I load the page I don't get "I am 10" rather it's blank page. But when I open the source code using Ctrl+U I can see "<p>I am {{ 4+6 }}</p>"

enter image description here

I am using XAMMP to access my files.

1
  • 2
    Path is correct, self closing script tag was causing problem as mentioned by @Tushar Commented Sep 16, 2015 at 7:50

3 Answers 3

4

You're using the self-closing script tag which will not work. See Why don't self-closing script tags work?

So, your app.js file is not included on the page and your angular app is not bootstrapped.

Use

<script type="text/javascript" src="app.js"></script>

Also, make sure the file paths are correct.

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

Comments

0

seems like your angular framework is not loaded to the page. make sure it is loaded correctly and check the paths. if you want you can use the network tab in developer tools to check that.

Comments

0

Your app.js will not load by this method of self closing tags because it is usually intended to contain some piece of code inside it. This prevents your module from being loaded hence your angular app is not working.

use

<script src="app.js"></script>

All the best!!!

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.