Leon Gaban
Leon Gaban

Reputation: 39028

How to setup Angular example app in jsFiddle?

So I'm trying to setup my Angular app example in jsFiddle to get help on another bug, however I'm getting a new bug:

enter image description here

http://jsfiddle.net/leongaban/scx479rw/

Added example in Plunker: http://plnkr.co/edit/yYQHbcatHOu5myL4MXZM?p=preview

I wasn't able to add ng-app="portal" to the html tag because jsFiddle generates it's own html tag in the output, so I put ng-app in my first div, could that be the problem?

"Uncaught Error: [$injector:nomod] Module 'portal' is not available!

HTML

 <div class="nav"
     ng-app="portal"
     ng-controller="NavController as nav">

Angular

var app = angular.module('portal');

// Controller for Nav
app.controller('NavController', function() {
    ....

If it can't find portal because of that issue, how would you setup an Angular app in jsFiddle?

Upvotes: 1

Views: 3837

Answers (1)

sylwester
sylwester

Reputation: 16498

Please see here http://jsfiddle.net/dvtofn6L/1/

You missed few bits 1:

var app = angular.module('portal', []);

2.

app.controller('SubNavController', function ($scope) {})
  1. Reference to jquery (you can add that in external source tab)

https://code.jquery.com/jquery-1.11.1.min.js

Upvotes: 2

Related Questions