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!