P____
P____

Reputation: 23

How to connect ng-app using AngularJS

I wrote out the last example on the angular website (angularjs.org/#create-components), but I'm not able to get the desired output.

Here is my code:

index.html, components.js,

and app.js is at pastebin.com/XDpSkHBb (but StackOverflow doesn't let me use more than 2 links)

I think the error is with <html ng-app="app">

because when I replace it with <html ng-app>

the Date: {{ '2012-04-01' | date:'fullDate' }}

are replaced with Date: Sunday, April 1, 2012

however, that means I'm no longer accessing the ng-app...

any thoughts on how I can fix this?

Upvotes: 2

Views: 192

Answers (1)

KayakDave
KayakDave

Reputation: 24676

In app.js you have a period at the end of this line which is causing an error:

few: '{} pivá'.

change it to a comma:

few: '{} pivá',

And everything runs cleanly. Here's a working plunker

I highly recommend adding a debugger, like Chrome Developer Tools, to your repertoire. It makes it really fast and easy to spot these issues that otherwise can be daunting.

In this case the developer tools console reported this error on your code:

Uncaught SyntaxError: Unexpected token : app.js:16

So I looked up one line, to line 15, and there's the issue:

few: '{} pivá'.

Upvotes: 2

Related Questions