laravel5-angular-material-starter: Error when make Dialog, when call function DialogService.fromTemplate('register'); ~ v3.1

Error: [ng:areq] Argument 'RegisterController' is not a function, got undefined
http://errors.angularjs.org/1.5.0/ng/areq?p0=RegisterController&p1=not%20a%20function%2C%20got%20undefined
    at angular.js:68
    at assertArg (angular.js:1825)
    at assertArgFn (angular.js:1835)
    at angular.js:9831
    at setupControllers (angular.js:8852)
    at nodeLinkFn (angular.js:8898)
    at compositeLinkFn (angular.js:8226)
    at nodeLinkFn (angular.js:8973)
    at compositeLinkFn (angular.js:8226)
    at compositeLinkFn (angular.js:8229)(anonymous function) @ angular.js:13236(anonymous function) @ angular.js:9965processQueue @ angular.js:15560(anonymous function) @ angular.js:15568Scope.$eval @ angular.js:16820Scope.$digest @ angular.js:16636Scope.$apply @ angular.js:16928done @ angular.js:11266completeRequest @ angular.js:11464(anonymous function) @ angular.js:11374callback @ angular.js:11495

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ register.dialog.js +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

export class RegisterController{
    constructor(DialogService){
        'ngInject';

        this.DialogService = DialogService;
    }

    save(){
        //
    }

    hide(){
        this.DialogService.hide();
    }
}

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ register.html +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

<md-dialog-actions ng-controller="RegisterController as vm">
    <form ng-submit="vm.save()">
        <md-dialog-content>
            <h2 class="md-title">Register</h2>

            <md-input-container flex>
                <label>Data</label>
                <input type="text">
              </md-input-container>

        </md-dialog-content>

        <div class="md-actions" layout="row">
            <md-button type="button" ng-click="vm.hide()">Cancel</md-button>
            <md-button class="md-primary md-raised" type="submit">Save</md-button>
        </div>
    </form>
</md-dialog-actions>

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

How to make dialog on laravel angular material? because I got error like this when I try to call DialogService.fromTemplate(‘register’);

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (16 by maintainers)

Most upvoted comments

Hi @flick36 Thanks for your comments Indeed the ng-controller="DialogController as vm" shouldn’t be there because it’s causing an issue, I’ll remove it and publish a new version And thanks for pointing our the directives issue… Indeed it should be fixed, but I need to find a way without creating a mess

The controller you created and imported in @jadjoubran 's last example, did you create is as a class or a function? because I think it should be a function, so something like

export function RegisterController(items){
    'ngInject';
}

and then import that in the file that calls the DialogService