Я пытаюсь заставить ng-repeat повторить список тем, но я получаю эту ошибку.
ОШИБКА
> TableUsersComponent.html:23 ERROR TypeError: Cannot read property
> 'name' of undefined
> at Object.eval [as updateRenderer] (TableUsersComponent.html:23)
> at Object.debugUpdateRenderer [as updateRenderer] (core.js:11080)
> at checkAndUpdateView (core.js:10456)
> at callViewAction (core.js:10692)
> at execComponentViewsAction (core.js:10634)
> at checkAndUpdateView (core.js:10457)
> at callViewAction (core.js:10692)
> at execComponentViewsAction (core.js:10634)
> at checkAndUpdateView (core.js:10457)
> at callWithDebugContext (core.js:11344)
HTML-код
<div ng-app="DemoApp" ng-controller="DemoController" class="ng-scope ng-binding">
<h1>Topics</h1>
<ul><li ng-repeat="tpname in TopicNames track by $index">
{{tpname.name}}
</li></ul>
</div>
JS CODE
var app = angular.module('DemoApp',[]);
app.controller('DemoController', function($scope){
$scope.model = {};
$scope.TopicNames =[
{name: "What controller do from Angular's perspective"},
{name: "Controller Methods"},
{name: "Building a basic controller"}];
});