I have a question regarding jsFiddle and Angular. I am currently learning the basics of Angular and I noticed that my code only works when I include the controller JS in the HTML pane. You can view my jsFiddle here.
Here is the code that works:
<div ng-app="myAppModule" ng-controller="someController">
<!-- Show the name in the browser -->
<h1>Welcome {{ name }}</h1>
<p>made by : {{userName}}</p>
<!-- Bind the input to the name -->
<input ng-model="name" name="name" placeholder="Enter your name" />
</div>
<script>
var myApp = angular.module('myAppModule', []);
myApp.controller('someController', function($scope) {
// do some stuff here
$scope.userName = "skube";
});
</script>
However, when I try to move the JS within the script tag to the JavaScript pane, it fails.