1

Following my code is not outputting the {{ title }} as 'hello world'. Although angular is not working but gives no error message.

<!-- HTML -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Angular</title>
</head>
<body np-app="myApp">
<div ng-controller="MainController">
{{ title }}
</div>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"                    integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="   crossorigin="anonymous"></script>`
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
<script type="text/javascript" src="angular.js"></script>
</body>
</html>

// Javascript

var app = angular.module("myApp", []);
app.controller("MainController", ['$scope', function($scope){
    $scope.title = "hello world";
}]);
0

1 Answer 1

12

You have a typo in your body tag as <body np-app="myApp"> which needs to be changed to <body ng-app="myApp">

Hope this helps!

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

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.