Angelos Chalaris Angelos Chalaris - 5 months ago 40
AngularJS Question

AngularJS Boilerplate works on Codepen but on on JSFiddle

I was trying to write a simple Angular app, when I came upon a problem. My perfectly simple and short boilerplate code runs entirely fine in a Codepen, but it fails to work in a JSFiddle. The snippet I created below works fine as well, but I cannot figure out why it does not work in JSFiddle. Could anyone point out what the problem is?

Codepen link:

JSFiddle link:

Code snippet:

var app = angular.module('myApp', []);
app.controller('myController', [
function($scope) {
$scope.demoText = 'AngularJS: This is some demo text!';

<script src=""></script>
<div ng-app="myApp">
<div ng-controller="myController">
{{ demoText }}

Lex Lex

You should click the JAVASCRIPT button and select an Angular version under the FRAMEWORKS & EXTENSIONS dropdown, instead of including it as an external resource.

Javascript options in JSFiddle

To fix your problem, you must select the LOAD TYPE as No wrap - in <head>.