3

I’m very impressed with Josh's answer about ‘angular way’ and declarative style in client-side.

But can you help me to understand, how to do that:

I have a single-page app with the menubar in the left side, and div container on the right-side.

When user clicking the menu item in the left menubar, on the right side I must to open the new tab with some grid,like this:

image

In angular I realized the <grid> directive.

When user click menuitem, I must add dynamically this grid directive with params on the right side.

What is the angular way for doing this functionality?

Update: I found article about dynamic tabs, and this is example how I use it in my case

Community
  • 1
  • 1
kabiev
  • 299
  • 3
  • 12

1 Answers1

4

Since you asked a general question, let me give you a general answer. It should be helpful :)

AngularJS is model/data driven, and if you want to make any change to the UI, the first thing you may think is how to achieve it by changing data. Given this idea, we can implement it like this:

  1. Define a ng-repeater, which should render tabs for a list of Tab objects called MyTabs, for instance.

  2. When you want to add a new tab, then create a tab object and add/push it to MyTabs.

  3. AngularJS will magically render it on the UI, thanks to the 2-way data binding.
zs2020
  • 53,766
  • 29
  • 154
  • 219