0

I'm learning AngularJS with WebStorm JetBrains, I have this very sample app, but it's not showing the array in the page when I press Debug button (it's open a webpage in Chrome like that:

http://localhost:63342/example/index.html

I'm using the Plugin Connector for Chrome and I don't have errors in the Chrome console.

Where is my error? Link to Fiddle

HTML (index.html)

<!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>

    </head>

<body ng-app="webStorm" ng-controller="webStormController as ws">
<div ng-repeat="person in ws" ng-click="ws.showPerson(person)">
    {{person.firstName}}
</div>
<script type="text/javascript" src="bower_components/angular/angular.min.js"></script>
<script type="text/javascript" src="app.js"></script>
</body>
</html>

JS (app.js)

    var webStorm = angular.module("webStorm", []);
    webStorm.controller("webStormController", function(){
    var ws = this;
    ws.people = [{firstName: "John", lastName: "Smith"}];
    console.log(ws.people);
    ws.showPerson = function (person) {
        console.log(person);
    }
})

Thanks!

2 Answers 2

2
<div ng-repeat="person in ws.people" ng-click="ws.showPerson(person)">
    {{person.firstName}}
</div>

change person in ws by person in ws.people

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

1 Comment

in starting some time its happen no worries my friend cheers :)
1

I think you meant: ng-repeat="person in ws.people", that's the array you want to iterate :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.