Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change div content dynamically on ng-click AngularJS

I want to display some data and tables in the content div which depends on which category you choose on the left hand side navigation. So if I change the category also the displayed content of the content div should change.

Here is my code on Plunkr.

But it seems that not even this simple example is working.

So I have two Questions:

1.) How can I fix this example code to run ?

But more important:

2.) Is there a better way to change the content div when you change the category ?

like image 783
JohnDizzle Avatar asked Feb 08 '23 17:02

JohnDizzle


1 Answers

I removed 'this' elements from code and also changed ng-view to ng-show.

<div>
  <div ng-show="showApple">{{content}}</div>
  <div ng-show="showBanana">{{content}}</div>
  <div ng-show="showOrange">{{content}}</div>
</div>

There was something wrong with that you named your div class "content" so I removed that also.

I am sure it isn't a perfect solution but now it works.

link to plnkr

like image 135
stackattack Avatar answered Feb 11 '23 01:02

stackattack