Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

can't add ng-controller to div #111

Open
RZsam opened this issue Sep 26, 2017 · 1 comment
Open

can't add ng-controller to div #111

RZsam opened this issue Sep 26, 2017 · 1 comment

Comments

@RZsam
Copy link

RZsam commented Sep 26, 2017

I'm using angularjs and angular ui router.
I want to use controller except default controller for this state
when I add ng-controller to div I have this error

angular.min.js:119 Error: [$injector:unpr] http://errors.angular.org/1.5.11/$injector/unpr?p0=myPicturesProvider%20%3C-%20myPictures%20%3C-%20MyPicturesController
    at /angular/angular.min.js:6:424
    at /angular/angular.min.js:43:219
    at Object.d [as get] (/angular/angular.min.js:41:1)
    at /angular/angular.min.js:43:281
    at d (/angular/angular.min.js:41:1)
    at e (/angular/angular.min.js:41:242)
    at Object.instantiate (/angular.min.js:42:77)
    at /angular/angular.min.js:91:374
    at Object.<anonymous> (/angular/router/angular-ui-router.min.js:11:15568)
    at/angular/angular.min.js:16:71 <ui-view class="ng-scope">How can I use ng-controller?

view:

<div id="single-post" class="modal" ng-controller="MyPicturesController">
<div class="modal-content fullHeight no-padding">

    <div class="row fullHeight">

        <div class="col m9 s12 fullHeight no-padding">
            <div class="picture-section fullHeight">
                <img class="picture" ng-src="[[PictureLink.original(current_picture)]]" alt="">
            </div>
        </div>
    </div>

   </div>
</div>

routes.js:

   .state('my', {
    templateUrl: 'panel/view/user_panel.layouts.my',
    controller: 'MyController'
})
   .state('my.journeys', {
        url: '/my/journeys',
        templateUrl: 'panel/view/user_panel.my.journeys',
        controller: 'MyJourneysController',
        resolve: {
            myJourneys: function (Request) {
                return Request.http('panel/my/journeys/table');
            }
        }
    })
@mysticfall
Copy link
Member

It looks like it's failing to resolve your controller class, MyJourneysController. Could you post a snippet showing how you declared your controller?

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

No branches or pull requests

2 participants