ng-view does not support ng-repeat rendering

I have a basic app using ng-view and ng-repeat. Initially, it worked fine without ng-view, but after switching to ng-view, the ng-repeat stopped functioning correctly. Oddly, when I clicked on the "menu" link, it displayed another set of $var instead of changing pages.

Advice from others suggested moving the items to $rootScope, but no matter how I try, I can't seem to make it work. The entire process fails silently, without any error messages to troubleshoot. It seems like $rootScope is being accessed, but something else is failing, though I'm not sure what.

I created a plunker at http://plnkr.co/edit/fuz6JELf1em7VHrY41u4 to showcase my second-to-last attempt. My latest attempt involves using a service, but that isn't working either.

app.controller('VerbsController', [ '$rootScope', function( $rootScope ) {
    $rootscope.jverbs = [
        {id: 41, name:"Furu", vClass:"Class I", plainPreAffR :"furu", plainPreAffK:"ふる", vKanji1:"下る, 降る", vDef1:"to fall, descend", vType1:"v.i. ", vKanji2:"振る", vDef2:"to wave, shake, swing; throw (dice); reject, abandon", vType2:"v.t."  },
        {id: 42, name:"Futoru", vClass:"Class I", plainPreAffR :"futoru", plainPreAffK:"ふとる", vKanji1:"太る", vDef1:"to gain weight, become fat", vType1:"v.i."  },
        {id: 43, name:"Fuyasu", vClass:"Class I", plainPreAffR :"fuyasu", plainPreAffK:"ふやす",vKanji1:"増やす", vDef1:"to increase, augment", vType1:"v.t."  }
    ];
}]);

app.controller('MenuController', function($scope, $location) {
    $scope.olist = function() { $location.path('/list'); };
});

app.controller('ListController', function( $rootscope, $scope, $location) {
    $scope.omenu = function() { $location.path('/menu'); };
}); 

There must be a small detail that I'm overlooking. Any help in finding it would be greatly appreciated!

Answer №1

After forking your plunkr and addressing the issue, it was clear that there were multiple errors in the code. The main issues stemmed from using incorrect cases and having route paths pointing to a nonexistent partial folder.

The primary concern was the incorrect definition of ListController, which caused problems with template rendering.

Here is an example of the original code (note the typo with $rootScope):

app.controller('ListController', function( $rootscope, $scope, $location) {
    $scope.omenu = function() { $location.path('/menu'); };
});

Below is the correct way to define ListController:

app.controller('ListController', ['$rootScope', '$scope', '$location',function( $rootScope, $scope, $location) {
    $scope.omenu = function() { $location.path('/menu'); };
}]);

You can see the corrected version in action here:

http://plnkr.co/edit/Y4O5bgy6NH4MIH8A0xWI?p=preview

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

There is a lack of communication between the tomcat application and the database

I am currently working on a web application that is stored in a war file and runs with Tomcat. Initially, I start my MySQL 5.7 database, followed by running a Spring Boot project created with the necessary files. After completing these steps, I deploy my ...

JQuery addClass function not functioning properly when used in conjunction with an AJAX request

I have a website where I've implemented an AJAX pagination system. Additionally, I've included a JQUERY call to add a class to certain list items within my document ready function. $(document).ready(function(){ $(".products ul li:nth-child(3 ...

What could be causing the href to malfunction on my local website?

I'm currently working on adding a new link that directs to a local HTML website within a menu list on a website. The main website is in ASPX format, but my focus is on the HTML version. The link I want to add leads to an HTML website stored on my loca ...

Ways to attach the close event to the jquery script

Hello, I'm having trouble reloading the parent page when the close button is clicked on a modal dialog. Here's my code snippet: //customer edit start $( ".modal-customeredit" ).click(function() { var myGroupId = $(this).attr('data- ...

Press the second form submit button after the completion of another Observable

Below is the unique process we aim to accomplish using solely RXJS Observables: Press Login button (form with username & password). We bind Observable.fromEvent with our form. Upon submitting the form, call loginUser() to send an http request to serv ...

Modifying a CSS property with jQuery

If I have the following HTML, how can I dynamically adjust the width of all "thinger" divs? ... <div class="thinger">...</div> <div class="thinger">...</div> <div class="thinger">...</div> ... One way to do this is usi ...

The difference between calling a function in the window.onload and in the body of a

In this HTML code snippet, I am trying to display the Colorado state flag using a canvas. However, I noticed that in order for the flag to be drawn correctly, I had to move certain lines of code from the window.onload() function to the drawLogo() function. ...

What causes images to be omitted from a PDF file when using mywindow.print()?

Here is the scenario I am dealing with: On a particular webpage, there is a print button. The page contains various information, including receipts. When the user clicks on "print", I want only the receipts to be printed: Below you can find the code for ...

Notification access is consistently denied

In my coding work, I rely on Notification.permission to determine if the browser supports notifications or not. Here's a snippet of how I handle Notification.permission in my script: // Verify browser notification support if (!("Notification" in windo ...

How can Node.js handle an upgrade request effectively?

Dealing with a websocket 'upgrade' event from a Node.js http server presents an interesting challenge - The upgrade handler takes the form of function(req, socket, head) - Is there a method to respond to this upgrade request without access to a r ...

What is the best way to retrieve an element made in a different function within JavaScript?

I have a main button on the screen and when I click that button, it generates two more buttons. These additional buttons should each have their own functionality and click events, but since they are created within a function without global variables or ids ...

Updating the scope in Angular when changing the image source using ng-src is not working

A snippet inside my controller looks like this: $scope.onFileSelect = function($files) { for(var i = 0; i < $files.length; i++) { var file = $files[i]; $scope.upload = $upload.upload({ url: '/smart2/api/files/profi ...

How can you notice when a DOM element is deleted from the page?

I am in the process of creating a custom directive that will ensure only one element is active at a time. Directive: displayOneAtATime Description: This directive can be applied to a DOM node to guarantee that only one element with this directive can be v ...

Using AngularJS controllers: How can one trigger a controller from within a different controller?

Within my script, I have a list controller defined as follows: define([ 'jquery', 'app' ], function ($,app) { app.controller("ListContacts", function($scope,$route,$http){ $http({ method: 'GET&apo ...

When using AngularJS to compile HTML with $compile and $scope, an error may occur stating: "Unable to convert circular

I have a project that involves creating dynamic HTML and adding it to an object array. This HTML needs to be displayed on the page and be responsive to user interactions, such as clicking. Angular requires me to use $compile to create an angularized templa ...

How can the data controller of a model be accessed within a directive that has been defined with "this"?

I'm struggling with accessing data using a directive, especially when I have defined my models like this: vm = this; vm.myModel = "hello"; Here is an example of my directive: function mySelectedAccount(){ return { restrict: 'A&ap ...

The Angular Material md-input-container consumes a significant amount of space

Currently, I am exploring a sample in Angular Material. It appears that the md-input-container tag is taking up a substantial amount of space by default. The output is shown below: https://i.sstatic.net/hQgpT.png However, I have come across the md-input- ...

Uploading files with Ajax in PHP

Illustration of my Ajax script: Script <script type="text/javascript> $(document).ready(function(){ $('.costExcel').on("submit",function(event){ event.preventDefault() var url = "ajax.php"; ...

Pictures will be displayed briefly for 1 second prior to the initiation of the JavaScript animation

I recently built a website using gatsby.js and incorporated bounce.js to animate some images on the page. Bounce.js is a JavaScript library that offers DOM animation functionalities. Although everything appears fine when I view the site locally, once I de ...

Unable to locate the element within a component using Cypress

I need help locating the dropdown arrow. I tried using the Cypress command cy.get('.dropdown-arrow').click() but it's throwing an error saying element not found. Below is the code snippet: <widgets-bms-scoreboard> <div class=&q ...