I am using an HTML page to call functions from an Angular.js page using $scope. No matter what i do, my result appears as {{heading + message}} instead of Hello (+) Users name. (see code below). I feel like this is an issue with not being able to call from my js file, or simply not being able to call the Angular library.
I tested out an example from the Angular.js website and it worked fine so i assume it cannot call the file. I have tried relative paths and direct paths, but neither seem to work for calling the first.js file.
Could it be a problem with not running a node.js server?
Here is the HTML and JS code (my code works perfectly on Stackflow's tester but not on my computer)
var firstApp = angular.module('firstApp', []);
firstApp.controller('FirstController', function($scope) {
$scope.first = 'Some';
$scope.last = 'One';
$scope.heading = 'Message: ';
$scope.updateMessage = function() {
$scope.message = 'Hello ' + $scope.first +' '+ $scope.last + '!';
};
});
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular.js"></script>
<script scr="C:\Users\Administrator\Documents\AngularTesting\js\first.js"></script>
<title>Name App</title>
</head>
<body ng-app="firstApp">
<div ng-controller="FirstController">
<span>Name:</span>
<input type="text" ng-model="first">
<input type="text" ng-model="last">
<button ng-click='updateMessage()'>Message</button>
<hr>
{{heading + message}}
</div>
<!--<script scr="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular.min.js"></script>-->
</body>
</html>