Utilizing various Angular templates

I'm currently in the process of setting up a calendar of events using Angular within Wordpress. All files are linked correctly, but I'm struggling with configuring the template to display two different views - one for Saturday and another for Sunday.

Here is the layout I'm aiming to achieve (taken from an older version of the same site):

Although my Angular template functions well for all fields, I can't figure out how to showcase the large Saturday section once with its related events underneath, followed by a separate set for Sunday. I attempted creating a fiddle for demonstration purposes, but encountered issues. Apologies for not providing a working example: http://jsfiddle.net/roob/vxfbmsr8/2/

The controller in the fiddle is designed to extract all necessary data, yet it doesn't work as intended. Below is a condensed version of my actual code. It may seem lengthy, but I've included a few filter options for clarity. Please disregard the choice of table tags; they're not mine. template/view:

<div ng-app="myApp">
      <div ng-controller="fobSchContr">
        <h1>Event Directory</h1>
        <label>search: </label>
        <input ng-model="query" placeholder="Search for Authors" autofocus>

        <select class="venues" id="filterTabs" ng-model="artistStage">
            <option value="!!">ALL VENUES</option>
            <option value ="Los Angeles Times Stage" id="lat-stage">LA Times Stage</option>
            <option value ="Cooking Stage" id="cooking-stage">Cooking Stage</option>
            <option value ="Hoy Stage" id="hoy-stage">Hoy Stage</option>
        </select>

        <select class="day" id="filterTabs" ng-model="artistDay">
          <option value='!!' class="all">BOTH DAYS</option>
          <option value ="Saturday" id="saturday">Saturday</option>
          <option value ="Sunday" id="sunday">Sunday</option>
        </select>

        <select class="times" id="filterTabs" ng-model="artistTime">
            <option value='!!' class="all">ALL TIMES</option>
            <option value ="10.00 am" id="10am">10 a.m. - 11 a.m.</option>
            <option value ="11.00 am" id="11am">11 a.m. - Noon</option>
        </select>

          <!-- Calendar BEGIN -->
          <div class="filterWrap" style="border:#FFFFFF thin solid; text-align:">
            ...
          </div>
        </div>
      </div>
    </div>

controller:

var myApp = angular.module('myApp', []);
            myApp.controller('fobSchContr', ['$scope', '$http', function($scope, $http) {
                $http.get('wp-content/themes/2015-Festival-of-Books/angular/js/data.json').success(function(data) {
                    $scope.artists = data;
                    //$scope.artistOrder = 'first_name';
                    $scope.artistStage = '!!';
                    $scope.artistDay = '!!';
                    $scope.artistTime = '!!';
                });
            }]);

Answer №1

When utilizing an ng-repeat on the h2 element, it will result in the repetition of that element.

 <h2 id="saturdayWrap" style="background-color:#FFFFFF; text-transform:uppercase;" ng-repeat="item in artists | filter:{value='Saturday'}" {{item.day}} </h2>

To avoid this, consider having the h2 stand alone and repeating the content beneath it instead.

<h2 id="saturdayWrap" style="background-color:#FFFFFF; text-transform:uppercase;">Saturday</h2>
<div ng-repeat="item in artists | filter:{value='Saturday'}">

--

Alternatively, you could maintain the current structure and create an array of 'days' to iterate through.

In your controller:

$scope.days = ['Saturday', 'Sunday'];

Then in your template:

          <h2 id="saturdayWrap" style="background-color:#FFFFFF; text-transform:uppercase;" ng-repeat="day in days"> {{day}} </h2>
          <div ng-repeat="item in artists | filter:{value=day}">
          <div class="target-stage stage-only" style="width:100%; border:none;" ng-repeat="item in artists | filter: query | filter: {stage: artistStage, day: artistDay, time: artistTime}">

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

Creating a React component that allows for pagination using data fetched from a

I have a Spring Boot endpoint that retrieves and lists items from a database: @RequestMapping(method = RequestMethod.GET, value = "/task", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<?> processTask(@Valid TaskSearchP ...

Open the CSV document

Why am I receiving an error stating ./vacancy-data.csv cannot be found when attempting to pass the csv file into the csvtojson npm package? The csv file is located in the same directory as the code below: var express = require('express'), route ...

Dealing with issues on both the client and server side is a common

I attempted to run both a client-side and server-side app, but I am having trouble achieving success. Initially, I built my client-side app using ReactJS and then copied all the files from the build folder to the client/build folder where the server-side ...

Learn how to retrieve the TextBox value from a button click within a Nested Gridview

I am trying to extract the value of a textbox inside a Nested Gridview using jQuery in ASP.NET. When a Button within the Nested Gridview is clicked, I want to display the textbox value in an alert box. Here is an example setup: <asp:GridView ID="Grid ...

Once the grunt build process is complete, execute "heroku run fileName" to launch the

In order to gain a deeper understanding of Heroku scheduling, I decided to delve into an informative post on the topic and followed the instructions provided to build the app. The highlight of the post was when I successfully executed heroku run numCheck a ...

What is the reason behind Babel including this redundant line of code in my build?

While utilizing Babel 7 and Gulp 4 in conjunction, I have noticed that the subsequent line of code is repeated five times within my build: function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterato ...

Tips for resolving JSON parsing issues within AngularJS

I am facing an issue when trying to send a contactItem (string element) from my index.html to my JavaScript application using Angular.js through http.post. Every time I attempt to post the contactItem, I encounter the following error: SyntaxError: Unexpec ...

I am facing an issue with the Angular signup page that is using ui-router, as it is unable

I have been working on an Angular sign-up page and here is the project directory structure: signUpPage-Angular bin bower_components model mongodbApp.js node_modules **partials fail.html main.html succe ...

Error in Mongodb: Unable to convert value into ObjectId

Currently, I am attempting to retrieve only the posts belonging to users using the following code snippet: router.get("/:username", async (req, res) => { try { const user = await User.findOne({ username: req.params.username }); const ...

Warning: Uncontrolled Input Issue with React Google Autocomplete

Within my React application, I have incorporated the react-google-autocomplete and antd packages. Here is how I am utilizing them: import { Button, Input, Form, Row, Col } from "antd"; .... const getCityFromPlace = (place) => { let city ...

What is the process for excluding a file from running in jest?

Currently, I am working on integration tests using Jest and I have a folder with 20 test files. However, there are three specific files in that folder that should not be executed during the testing process. I tried using testPathIgnorePatterns, but it seem ...

Error in React+Redux: Trying to access the "address" property of a null value is not permitted

I am new to using react and encountering an issue with my ecommerce app. The app runs smoothly until I log out and then log back in at the shipping address page, which triggers the following error: TypeError: Cannot read property 'address' of nu ...

Bot on Discord using Discord.Js that generates unique invites for users

I'm trying to find a way to generate an invite link for users to keep track of invites. The code I have currently is creating the invite for the Bot instead. const channel = client.channels.cache.find(channel => channel.id === config.server.channel ...

Utilizing model associations in Sails.js to populate an array

I am currently using "sails": "~0.10.0-rc5", "sails-mongo": "^0.10.0-rc3". I have two models: Invoice and Item. Invoice model Invoice: { name: 'sample 1', items: [1,2] // 1,2 are the ids of the Item model } Item model Item { id: 1 ...

Delay loading background image until a specific time has passed, preventing website from fully loading

My website features a vibrant backgroundImage Slideshow that functions seamlessly. However, I am looking to reload the images of the slideshow after a specific time interval. The issue is that the website keeps loading endlessly. Once the website has com ...

JavaScript countdown feature that includes hours and minutes

Currently, I have successfully implemented a countdown timer in seconds. However, I am looking to enhance this by incorporating hours and minutes into the countdown as well while maintaining the existing structure using only pure JavaScript. The desired ou ...

Adding a Table Row in jQuery without Appending it to the Bottom of the Table

I am working on a project that involves an HTML Table where the user can add a new Row by clicking a button. However, I want the new Row to be added not at the end of the table, but after the last row of input fields. To demonstrate, I have prepared a sam ...

button that smooth slides out using jquery

Here is the source code for a jQuery slideout: jQuery(function($) { $('#slideClick').toggle(function() { $(this).parent().animate({left:'0px'}, {queue:false, duration: 500}); }, function() { $(t ...

Is there a feature in Angular similar to Vue.js's "computed property" functionality?

After mastering Vue.js, I recently dove into Angular 4 for a new project. I've found that most things in Angular are quite similar to Vue, with the notable exception of "Computed Property". In Vue, I could easily create a computed property that would ...

Store the encoded data in a variable

After looking at some examples, I attempted to create my own solution but encountered an issue with the Promise being stuck in a "pending" state. My goal is to store base 64 data into a variable named base64. Can anyone offer guidance on what's wrong ...