user1469270
user1469270

Reputation:

Angular JS not working as intended

I am following a tutorial on Angular JS, from Dan Wahlin. I have followed his tutorial, and hope to get a simple unordered list:

<!doctype html>
<html data-ng-app>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
</head>
<body>
    <div class="container" data-ng-init="names=['Tom', 'Rosie', 'Febe, 'Jack']">
         <h3>Looping with ng-repeat directives</h3>
        <ul>
            <li data-ng-repeat="person in names">{{person}}</li>
        </ul>
    </div>
</body>
</html>

However, none of the Angular renders, and I get this in the console:

Error: [$parse:lexerr] http://errors.angularjs.org/1.2.6/$parse/lexerr?p0=Unterminated%20quote&p1=s%2035-37%20%5B'%5D%5D&p2=names%3D%5B'Tom'%2C%20'Rosie'%2C%20'Febe%2C%20'Jack'%5D
    at Error (<anonymous>)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:6:449
    at Jb.throwError (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:148:477)
    at Jb.readString (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:152:224)
    at Jb.lex (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:145:463)
    at Wa.parse (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:152:453)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:90:353
    at h.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:101:141)
    at pre (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:181:168)
    at W (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js:48:462) <div class="container" data-ng-init="names=['Tom', 'Rosie', 'Febe, 'Jack']"> angular.js:9383

Would anyone be able to see where I am going wrong, or point me in a better direction?

Upvotes: 0

Views: 679

Answers (1)

dcodesmith
dcodesmith

Reputation: 9614

You didn't close the quote on Fred

//Fred missing closing quote

<div class="container" data-ng-init="names=['Tom', 'Rosie', 'Febe, 'Jack']">


<div class="container" data-ng-init="names=['Tom', 'Rosie', 'Febe', 'Jack']">

As the error clearly states Unterminated quotes

JSFIDDLE

Upvotes: 1

Related Questions