4

My application is being upgraded to use angularjs 1.3 from 1.0.5. Because of this several components are broken in the application like "ngRoute" as a separate module, but this is not a big issue. I have been using multiple directives on the same elements and now this model does not work anymore. If they were my own directives I could have modified the directives but those are ngDirectives which I don't know how to fix. Here is an example which breaks:

<div ng-switch-when="view" ng-include=" 'views/view1.html' "></div>

and inside 'view1.html' I have something like this:

<div ng-grid="gridData"
             ng-switch-when="grid"></div>

I tried following:

<div ng-switch-when="view1">
        <ng-include src=" 'views/view1.html' "></ng-include>
    </div>

I get similar errors like "multidir". I don't know what steps I should I follow to make my application working. Any help is appreciable.

me_digvijay
  • 5,374
  • 9
  • 46
  • 83

2 Answers2

3

Use ng-if instead of ng-switch-when to resolve the issue, both work as same.

<div ng-if="view" ng-include="'/partial.html'"></div>

Working Fiddle

For more info Refer this SO Answer

Community
  • 1
  • 1
Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299
1

Although the above solution works, that is only for one case though. I think you will find most of your answers over here: https://docs.angularjs.org/guide/migration

Sney19
  • 125
  • 1
  • 4