0

I don't know what's wrong here. An explanation would be lovely. Thanks!

http://jsfiddle.net/natecraft/xKtwP/13/

<body data-ng-app="channelApp">
  <div data-ng-controller="channelController">
    Hello! {{ name }}
  </div>
</body>

var mod = angular.module("channelApp", []);
mod.controller = ("channelController", function($scope) {
$scope.name = "nate"; 

});

1 Answer 1

1

There are two separate issues causing this unexpected behavior. First, the syntax for the controller should be like this:

var mod = angular.module("channelApp", []);
mod.controller("channelController", function($scope) {
   $scope.name = "nate"; 

});

Second, the fiddle is setup incorrectly and still won't render properly after making the above fix. I have fixed the fiddle configuration in this forked version of your fiddle.

I also created the code example in CodePen for further reference.

Sign up to request clarification or add additional context in comments.

7 Comments

So the problem in jsfiddle is due to the use of the body-element? I tried to get the jsFiddle running but couldn't figure it out.
I just updated the fiddle link. Sorry, I had replaced the <body> with a <section> during my debugging, but that wasn't the fix. The fiddle configuration fix involved clearing the "body tag" box under Fiddle Options and selecting the AngularJS library under Frameworks.
nate -Are the link to the fiddle and CodePen examples in my answer working for you?
nate - you still need to remove the <body ng-app> from the "body tag" edit box under the Fiddle Options sections on the left.
Thanks Adam it works! I'm new to fiddle too so definitely learned a lot here.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.