Joe Consterdine Joe Consterdine - 1 year ago 103
AngularJS Question

Angular not working but no errors

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">
<meta charset="UTF-8">
<body np-app="myApp">
<div ng-controller="MainController">
{{ title }}
<script src="" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>`
<script src=""></script>
<script type="text/javascript" src="angular.js"></script>

// Javascript

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

Answer Source

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!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download