span
is not displayed but the button in the li
tag is being displayed if ng-repeat
is not used , but once i use ng-repeat
, neither the span
nor the button is being displayed.
I have used ng-repeat
numerous times but never faced such a situation, both span
and button elements are not displayed if I use ng-repeat
in the li
tag.
This is the index.html file:
<ul id="contactdelete">
<li ng-repeat="contact in $ctrl.contacts">
<span>{{contact.name}}</span>
<button ng-click="$ctrl.deletecontact()">Delete</button>
</li>
</ul>
This is the controller.js file
(function() {
class ContactsComponent {
constructor($http) {
var result;
$http.get("/api/contacts/").success(function(response) {
result = response;
});
this.contacts = result;
}
}
angular.module('myApp')
.component('contacts', {
templateUrl: 'app/contacts/contacts.html',
controller: ContactsComponent
});
})();