jadjoubran / laravel5-angular-material-starter

Get started with Laravel 5.3 and AngularJS (material)
https://laravel-angular.readme.io/
MIT License
1.66k stars 401 forks source link

Importing module to the controller #471

Closed ryvan-js closed 7 years ago

ryvan-js commented 7 years ago

hello there the documentation is quiet limited and vague in certain areas, i would like to use a module to generate tables http://iamisti.github.io/mdDataTable/. and i have no idea how to implement that into the controller, can you please help me out, google din't help much and stuck there for quiet long.

especially this line

angular.module('exampleApp', ['ngMaterial', 'mdDataTable']);

in this case exampleApp is the controller's name.and i believe laravel angular starter doesn't requires controller name to be defined actively,which means there is no ng-controller='' attribute. thanks.

jadjoubran commented 7 years ago

Hi @ryvan-js You should go to index.module.js and register 'mdDataTable' there under angular.module. ngMaterial is already registered so you don't need to worry about that. And then you will be able to use md-data-table

ryvan-js commented 7 years ago

Hello there, fairly made it. but i gotha reinstall the framework and fresh bower with md-data-table included.thanks for the support.

ryvan-js commented 7 years ago

i am also having issues with defining $mdToast from the code below.

 angular.module('exampleApp19').controller('ExampleController19', function($scope, $mdToast){
        $scope.selectedRowCallback = function(rows){
            $mdToast.show(
                $mdToast.simple()
                    .content('Selected row id(s): '+rows)
                    .hideDelay(3000)
            );
        };

i have tried declaring it inside the constructor as this.$mdToast = $mdToast,but doesn't seems to work.

jadjoubran commented 7 years ago

The issue is that $mdToast is undefined, there's a descriptive explanation for that in this issue Cheers!