1

Can i put an anchor tag (<a>) inside a ng-switch-when? Here is my code: ( HERE IS A PREVIEW PLNKR LINK) i want to do something like this:

<div ng-switch-when="Jquery">
    <h3>Jquery</h3>

    <a class="col-md-1 menu" ng-class="{active: tab == 'Angular'}" ng-click="tab='Angular'"><b>Angular</b></a>

    <br /> jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML. jQuery is the most popular JavaScript library in use today, with installation on 65% of the top 10 million highest-trafficked sites on the
    Web. jQuery is free, open-source software licensed under the MIT License.
</div>

Here i have 3 menus, and on second menu (JQUERY), I put a link to menu 1 (ANGULAR), but it does not work... Can anyone help me please?

Thanks a lot!!

1 Answer 1

1

ng-switch creates a new scope... you need to use $parent to access the correct scope to define the tab attribute:

<a class="col-md-1 menu" ng-click="$parent.tab='Angular'"><b>Angular</b></a>

(I removed the class because it was unnecessary here)

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot! you're my hero !!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.