wesshi
wesshi

Reputation: 231

angularjs import makes html page not functional

I have very simple code

<!DOCTYPE html>
<html ng-app="app">
  <head>
    <link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="assets/css/app.css" />
    <script type="text/javascript" src="assets/js/angular.min.js" />
    <script type="text/javascript" src="assets/js/app.js" />
  </head>
  <body>
    asdfasdf
    {{1+2}}
  </body>
</html>

and I'm pretty sure everything is pointing to the right directory. My app.js is:

( function () {

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

}) ();

However, opening index.html on localhost all I can see is a blank page but when I delete the lines

    <script type="text/javascript" src="assets/js/angular.min.js" />
    <script type="text/javascript" src="assets/js/app.js" />

I get a page that says "asdfasdf {{1+2}}" How can I get angular working? Is there a big mistake I'm making somewhere?

Upvotes: 0

Views: 75

Answers (1)

Michael Kang
Michael Kang

Reputation: 52837

Script tags must have an end tag. They cannot be self-terminating.

 <script type="text/javascript" src="assets/js/app.js"></script>

Upvotes: 1

Related Questions