TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Vipin Tyagi
NA
2k
663.7k
Difference between these two?
May 13 2016 1:11 AM
Yesterday,I posted a question on AngularJS.
Then I found the solution but still I don't know the difference b/w these 2 code snippets
NOT WORKING:
<!DOCTYPE html>
<html >
<head>
<title>MyPage</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular.min.js">
</script>
</head>
<body ng-app>
{{8*9}}
<div ng-controller="mainController">
{{message}}
</div>
<script type="text/javascript">
var mainController=function($scope){
$scope.message="Hello";
};
</script>
</body>
</html>
Note: This is working fine when I watched a Video and the guy is using Plnkr.co to run this.
Working:
<!DOCTYPE html>
<html >
<head>
<title>MyPage</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular.min.js">
</script>
</head>
<body ng-app="myApp">
{{8*9}}
<div ng-controller="mainController">
{{message}}
</div>
<script type="text/javascript">
var app = angular.module("myApp", []);
app.controller("mainController", function($scope) {
$scope.message="Hello";
});
</script>
</body>
</html>
Please Someone explain it!!!!
Reply
Answers (
7
)
My simple AngularJs code is not running!
& symol does not save angularjs with java application.