Content not being displayed by ng-repeat

Currently, I am in the process of developing a web application using Node.js with Express serving as the backend and HoganJs as the templating engine, while AngularJS is being utilized on the frontend. However, I have encountered an issue where the ng-repeat directive is not rendering the correct number of elements with no content inside them. I attempted to simplify the ng-repeat into a smaller example, but the problem still persists.

UPDATE: After correcting a typo in the Plunkr, I have provided a more detailed excerpt from my application.

Below is a snippet of my view: index.hjs

<div class="search-results" ng-controller="results">
    <ul class="tracks">
        <li class="track" ng-repeat="track in tracks">
                <ul class="meta">
                    <li>
                        <div class="name">
                            <span class="value">{{track.name}}</span>
                        </div>  
                    </li>
                    <li>
                        <div class="album">Album: 
                            <span class="value">{{track.album}}</span>
                        </div>  
                    </li>
                    <li>
                        <div class="artist">Artist:  
                            <span class="value">{{track.artist}}</span>
                        </div>  
                    </li>
                    <li>
                        <div class="length">Length:  
                            <span class="value">{{track.length}}</span>
                        </div>  
                    </li>
                </ul>   
            </li>
        </ul>
    </div>

The results controller: js/controllers/results.js

var results = function($scope, socket) {
    $scope.tracks = [
        {"uri":"spotify:track:1jdNcAD8Ir58RlsdGjJJdx","name":"Ho Hey","artist":"The Lumineers","album":"The Lumineers"},
        {"uri":"spotify:track:3uuGbRzMsDI5RiKWKOjqWL","name":"Hey Porsche","artist":"Nelly","album":"Hey Porsche"},
        {"uri":"spotify:track:5BSndweF91KDqyxANsZcQH","name":"Ho Hey","artist":"The Lumineers","album":"The Lumineers"},
        {"uri":"spotify:track:2UNc0duOP4cS7gqYFFkwxT","name":"Hey Girl","artist":"Billy Currington","album":"Hey Girl"},
        {"uri":"spotify:track:6fgbQt13JlpN59PytgTMsA","name":"Snow [Hey Oh]","artist":"Red Hot Chili Peppers","album":"Snow [Hey Oh]"}
    ];

    socket.on("results", function(tracks) {
        $scope.tracks = tracks;
        console.dir(JSON.stringify($scope.tracks));
    });

    $scope.add = function(uri) {
        socket.emit("add", uri);
    };
};

Lastly, here is my module: app.js

var app = angular.module("app", []);

var factories = {
    socket: socket
};
app.factory(factories);

var controllers = {
    actions: actions,
    search: search,
    results: results,
    queue: queue
};
app.controller(controllers);

During testing, I noticed that the tracks are hardcoded into the app and when run, five li elements are rendered without any templated content within them.

Answer №2

It finally clicked for me - Hogan.js is actually replacing Angular's templates during server-side rendering process.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ways to retrieve every span within a string variable that possesses a specific class designation

I'm having trouble listing out all spans with the class "ansspans." There may be one or more span elements with the "ansspans" class, and I need to retrieve them along with their content in order to iterate through them. Can someone explain how to do ...

Is it necessary to decode the JSON data stored in the variable?

Consider the code snippet below: var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var responses = JSON.parse(this.responseText); var ...

extracting and interpreting JSON information from a socket using Node.js

Looking for a solution to buffer JSON data received from client(s) on my node.js net tcp server until the entire block arrives. I'm considering either parsing it or forwarding it elsewhere. Are there any modules out there that are compatible with the ...

Tips for automatically choosing several choices from a multiple-select using Chosen.JS

I am struggling to programmatically select multiple values in a multiple select using chosenJS/chosen.js while still ensuring that the selected values are bound to my ng-model (angularJS). In this scenario, I have a list of users, some of whom are already ...

Creating dynamically generated routes in Angular or Angular 9 before initialization

I'm currently working on a project where I am in the process of converting an AngularJS application to Angular. The main challenge that I am facing at the moment revolves around routing. To sum it up: My requirement is to define routes based on an AP ...

Having some trouble implementing the functionality of hiding a data series in HighCharts using `{ data: [], visible: false }` notation

I am currently working on creating a graph that displays multiple series obtained from JSON data in a MySQL database. My goal is to have the graph show only one series initially. Thankfully, HighCharts offers an option to achieve this as demonstrated below ...

Retrieving information from AngularJS modal window

Seeking a solution to retrieve data FROM modal to invoking controller, as most examples only cover sending data TO the modal. What is the proper method for achieving this? Here is the form used within the modal: <form class="form-horizontal"> < ...

The issue of a malfunctioning react TypeScript map when used in conjunction with useContext

I am attempting to retrieve data from the TVMaze API using React, TypeScript, and useContext. Although I can display the data, the useContext does not update with the return value, so when I use the map function, nothing is displayed. Any advice on how to ...

The checkbox will be automatically checked whenever there is any modification in the textbox

I'm currently working on a Grid view with a checkbox and two textboxes. What I want is for the checkbox to be automatically checked whenever there is a change in one of the textbox values, for example switching from 0 to 1. This project is being devel ...

Chunk loading in IE 11 has encountered an error

Having an issue with my website which is created using Angular 5. It seems to be malfunctioning in IE 11, and I am encountering the following error in the console: https://i.stack.imgur.com/Ek895.png Any insights on why my Angular code isn't functio ...

Clicking the identical button on multiple overlapping elements using Selenium and Node.js

Working with Selenium has presented a challenge when trying to close multiple HTML elements that share the same "close" button and overlap each other. The initial approach of looping through them individually to close seemed unsuccessful. The first step i ...

Tips for overcoming cross-origin errors when making HTTP requests from Ionic

Struggling to make a HTTP GET request from my ionic app and running into cross-origin error hurdles. In my Angular.JS app, I managed to overcome this issue by utilizing Factory. Similarly, in my Meteor app, I solved it by shifting the call to the server s ...

Error encountered: EISDIR when using the "Cordova encrypted file plugin"

Recently, I encountered an issue with my ionic application built using ionic V1. A persistent EISDIR error keeps appearing whenever I try to build it. Upon investigating, I discovered that the culprit behind this error is the cordova-plugin-crypt-file. Dis ...

Can a repetitive 'setTimeout' function invocation ultimately cause the JS Engine to crash?

Imagine a scenario where I require data from the server every 10 seconds. A function would be created to fetch the data using AJAX, and then setTimeout would be used to schedule the function to run again: function RetrieveData(){ $.ajax({ url: " ...

Personalize headers in v-data-table while preserving default sorting capabilities

I'm looking to enhance my v-data-table by making the table headers "tab-able". To achieve this, I decided to create a slot and include tabindex on the columns. However, I encountered an issue where the sorting functionality stopped working. Does an ...

Creating a Website that Adapts to Different Browser Sizes: Tips and Tricks

I am currently working on a website that features a video background (mp4 file). However, I noticed that the video appears differently in Chrome, Explorer, and Firefox. In order to ensure compatibility across all browsers, I need to make some adjustments i ...

Positioning oversized images in a React Native application

Looking to showcase two images side by side using React Native, where I can customize the screen percentage each image takes up. The combined size of the images will exceed the horizontal screen space available, so I want them to maintain their original di ...

Unable to change the main data of slot object in VueJS

When running this demo and selecting "modify in child", the text will be updated. However, if you choose "modify top level through slot", the text remains unchanged, and attempting to click the other button afterwards will not work. Is there a way to upda ...

Why is my Feed2JS RSS feed functional locally but not operational after deployment on GitHub Pages?

I've been using feedtojs.org to display my Medium blog posts on my GitHub Pages website. Strangely enough, it works perfectly fine on my local server but not on the actual domain. The RSS feed is valid. Here's how it appears on my local server: ...

"Unexpected behavior: PHP+JS getElementById() function is returning an integer value instead of a

EDIT: Apologies for the PHP section not displaying correctly. I am attempting to extract a decimal value from PHP/HTML in JavaScript using getElementByID().value. However, despite the PHP value being decimal, it is represented as an integer in JavaScript ...