Emma
Emma

Reputation: 35

How to set up Angular

I am building a web app with Angular and have written some HTML, but the Angular isn't working. It's as if it's not being downloaded. So when I include a test angular expression in my html like {{1+2}} it is rendered exactly like that. Is there anything that I need to do besides include the following line in my HTML code?

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>

I'm sorry that this isn't the most interesting question, but I have been stuck without working Angular for a while, and I really can't figure out why. Thanks!

Upvotes: 0

Views: 154

Answers (2)

jackdbernier
jackdbernier

Reputation: 1572

You need to define the module and the controller. Look for ng-app and ng-controller in this Plunker http://plnkr.co/edit/jcLnWlg3Kw7i6QuCjrdK?p=preview

You can also take a look at the angularjs seed https://github.com/angular/angular-seed

Upvotes: 2

Seano666
Seano666

Reputation: 2238

Try adding the type attribute, I've seen this cause problems before.

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>

Also, definitely use F12 tools/firebug/etc.. to see if the script is actually loading when your document is loaded.

Upvotes: 0

Related Questions