Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mflasquin opened this issue Apr 10, 2017 · 0 comments
Open

Comments

@mflasquin
Copy link

mflasquin commented Apr 10, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant