Freaky1
Freaky1

Reputation: 3

Angular Expression not evaluating

I'm very new to Angularjs. I have managed to install eclipse plugin for Angularjs and started a simple code. When i have the below code, the expressions are evaluating properly. I have visited similar problems reported in stackoverflow ad have tried all suggestions, but in my case, i just evaluate {{ 7 + 8}} which is straight forward. Please any help here is appreciated. Thanks.

<html ng-app>

As soon as i change to poing ng-app to my module, the page breaks and expressions are not evaluating.

<html ng-app = "corpo">    --> Fails

myapp.html

<html ng-app>
<head>
<script type="text/javascript" src="corp/WebContent/corp.js"></script>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>

<title>Corp</title>
</head>
<body>
<div>
    <p>{{ 7 + 19 }}</p>
</div>

</body>
</html>

corp.js

var corp = angular.module('corpo', []);

Also i keep getting undefined javascript file and i have disabled the validation under properties.

Upvotes: 0

Views: 1200

Answers (4)

Sachin Kariyattin
Sachin Kariyattin

Reputation: 560

I think your "corp.js" is not in the right path.

working plunker demo

Post your application directory structure. I am sure the problem is with that.

Upvotes: 0

Hadi
Hadi

Reputation: 17289

var corp = angular.module('corpo', []);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<html ng-app="corpo">
<head>
<title>Corp</title>
</head>
<body>
<div>
    <p>{{ 7 + 19 }}</p>
</div>

</body>
</html>

change this

<src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js">        </script>
 <script type="text/javascript" src="corp/WebContent/corp.js"></script>

Upvotes: 0

Pankaj Ladhar
Pankaj Ladhar

Reputation: 155

Its failing because you have injected corp.js before angular.min.js
corp.js after angular.min.js, it will start working

Upvotes: 0

Anik Islam Abhi
Anik Islam Abhi

Reputation: 25352

Put corpo below of angular library

Like this

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
<script type="text/javascript" src="corp/WebContent/corp.js"></script>

Upvotes: 1

Related Questions