greencatsoft / scalajs-angular

AngularJS Binding for Scala.js
Apache License 2.0
253 stars 42 forks source link

can't add ng-controller to div #111

Open RZsam opened 7 years ago

RZsam commented 7 years ago

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 commented 7 years ago

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