user4869699
user4869699

Reputation:

Abstract state in AngularJS

I am new to the Ionic framework. I am using the ionic tabs. This tabs works fine.

.state('tab', {
    url: '/tab',
    abstract: true,
    templateUrl: 'templates/tabs.html'
  })

I want to know the meaning of abstract here. What does abstract do? If I set abstarct:false or comment this then this also works without any effect.

Upvotes: 1

Views: 492

Answers (1)

Shashank Agrawal
Shashank Agrawal

Reputation: 25797

It is the feature of angular-ui-router but not ionic. Please see it here: https://github.com/angular-ui/ui-router/wiki/Nested-States-and-Nested-Views#abstract-states

From the docs:

An abstract state can have child states but can not get activated itself. An 'abstract' state is simply a state that can't be transitioned to. It is activated implicitly when one of its descendants are activated.

Some examples of how you might use an abstract state are:

  1. To prepend a url to all child state urls.
  2. To provide resolved dependencies via resolve for use by child states.
  3. To provide inherited custom data via data for use by child states or an event listener.
  4. To run an onEnter or onExit function that may modify the application in someway. 4.Any combination of the above.

Upvotes: 1

Related Questions