AAT
AAT

Reputation: 411

state could not be resolved in angularjs

I am using nested view for ui-router. My menu html

<li ng-class="{active: $state.includes('staffs')}">
                <a ui-sref="dashboard"><i class="fa fa-users"></i> <span class="nav-label">{{ 'STAFFS' | translate }}</span> <span class="fa arrow"></span></a>
                <ul class="nav nav-second-level collapse" ng-class="{in: $state.includes('staffs')}">
                    <li ui-sref-active="active"><a ui-sref="staffs.add"><i class="fa fa-circle-o"></i>{{ 'ADDSTAFF' | translate }}</a></li>
                    <li ui-sref-active="active"><a ui-sref="staffs.view"><i class="fa fa-circle-o"></i>{{ 'VIEWSTAFFS' | translate }}</a></li>
                    <li ui-sref-active="active"><a ui-sref="staffs.permission"><i class="fa fa-circle-o"></i>{{ 'STAFFPERMISSION' | translate }}</a></li>
                    <li ui-sref-active="active"><a ui-sref="staffs.prdtype"><i class="fa fa-circle-o"></i>{{ 'PRODUCTTYPE' | translate }}</a></li>  
                </ul>
            </li>

Below is my config.js

.state('staffs.add', {
            abstract: true,
            url: "/add_staff",
            templateUrl: "views/staff_add.php",
        })

I am getting an error Error: Could not resolve 'staffs.add' from state ''. Can anyone tell me where am I doing wrong

Upvotes: 0

Views: 52

Answers (2)

Vamsi
Vamsi

Reputation: 9780

You cannot go to an abstract state, abstract state can act as container/parent state

remove abstract: true, it should work

I'm not sure how .php files are usable as angular template

Upvotes: 1

Rashid Javed
Rashid Javed

Reputation: 62

You are not providing the name of state try this

 <li ui-sref-active="active"><a ui-sref="staffs.addstaffs"><i class="fa fa-circle-o"></i>{{ 'ADDSTAFF' | translate }}</a></li>

Upvotes: 0

Related Questions