Skip to content

Could not resolve 'undefined' from state dropdown menu and ng-click #420

@mflasquin

Description

@mflasquin

I've an error when I try to use the ng-click directive in the dropdown menu with angular-ui-mobile.

I get this error :

[phonegap] [console.error] Error: Could not resolve 'undefined' from state 'candidate'
[phonegap] w/z.transitionTo@http://127.0.0.1:3000/vendor/angular-ui-router/release/angular-ui-router.min.js:7:17378
[phonegap] w/z.go@http://127.0.0.1:3000/vendor/angular-ui-router/release/angular-ui-router.min.js:7:16936
[phonegap] G/</i<@http://127.0.0.1:3000/vendor/angular-ui-router/release/angular-ui-router.min.js:7:25826
[phonegap] e/q<@http://127.0.0.1:3000/vendor/angular/angular.min.js:161:195
[phonegap] f@http://127.0.0.1:3000/vendor/angular/angular.min.js:47:146
[phonegap] lg/k.defer/c<@http://127.0.0.1:3000/vendor/angular/angular.min.js:50:68

This is my js code :

(function () {
    'use strict';

    app.controller('candidateController', candidateController);

    candidateController.$inject = [
        '$scope',
    ];

    function candidateController($scope) {
        var ctrl = this;
        ctrl.myfunction = myfunction;

        function myfunction() {
            alert('toto');
        }
    }
})();

My HTML code :

<div class="navbar navbar-app navbar-absolute-top">

    <div class="btn-group pull-right">
        <a ui-turn-on='myDropdown' class='btn'>
            <i class="alt-i icon-alt-menu"></i>
        </a>
        <ul
                class="dropdown-menu ng-hide"
                ui-outer-click="Ui.turnOff('myDropdown')"
                ui-outer-click-if="Ui.active('myDropdown')"
                role="menu"
                ui-show="myDropdown"
                ui-state="myDropdown"
                ui-shared-state="candidate"
                ui-turn-off="myDropdown">

            <li>
                <a href="#" ng-click="ctrl.myfunction()">
                    <i class="alt-i icon"></i>
                    <span>Mon stand</span>
                </a>
            </li>
        </ul>
    </div>
</div>

And my state provider :

$stateProvider
    .state('candidate', {
        url: '/candidate',
        templateUrl: 'app/components/candidate/views/candidate.view.html',
        controller: "candidateController",
        controllerAs: 'ctrl'
})

I don't understand this error, the "alert" works well. Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions