S
S
Sergey2015-08-30 08:47:59
JavaScript
Sergey, 2015-08-30 08:47:59

Why is ng-repeat not working?

output not working

<h3>Events</h3>
<div ng-repeat="e in vm.events">    
{{e.name}}
{{e.date}}
{{e.locality}}
</div>
{{vm.events.locality}}

At the same time , it {{vm.events.locality}}works, the data comes and is output. What is the problem? What did I miss?
The directive in which it all happens
angular
        .module('app.research')
        .directive('researchEvents', researchEvents);


function researchEvents() {
    var directive = {
        restrict: 'EA',
        templateUrl: 'research/client/directives/researchEventsDirective/research.events.client.directive.html',
        scope: {
           
        },
        link: linkFunc,
        controller: ExampleController,
        controllerAs: 'vm'
    };

    return directive;

    function linkFunc(scope, el, attr, ctrl) {

        console.log(scope.vm.events);
 
    }
}

ExampleController.$inject = ['researchEventsService'];

function ExampleController(researchEventsService) {
 
    var vm = this;

    vm.events = researchEventsService.get();
}

Actually, here

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2015-09-04
@AndyGrom

There is a suspicion that vm.events is not an array, but an object.
ng-repeat has a different form for objects.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question