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

ngdoc example block not working if we add angular material as dependency #149

Open
BalachanderJ opened this issue Apr 29, 2016 · 0 comments

Comments

@BalachanderJ
Copy link

My grunt ngdocs task below.

ngdocs: {
            options: {
                dest: 'site/docs',
                html5Mode: false,
                startPage: '/api',
                scripts: [
                    'bower_components/angular/angular.js'
                    'bower_components/angular-animate/angular-animate.js',
                    'bower_components/angular-material/angular-material.js'
                ]
            },
            api: {
                src: ['app/**/*.js','!app/**/*-spec.js','app/index.ngdoc'],
                title: 'Docs'
            }
        }

My ngdoc example block copied from angular documentation. I just added 'ngMaterial' as a dependency.

 <example module="sample">
    <file name="index.html">
<div ng-controller="ExampleController">
  <form novalidate>
    <h3>User 1</h3>
    Name: <input type="text" ng-model="user1.name">
    Age: <input type="number" ng-model="user1.age">

    <h3>User 2</h3>
    Name: <input type="text" ng-model="user2.name">
    Age: <input type="number" ng-model="user2.age">

    <div>
      <br/>
      <input type="button" value="Compare" ng-click="compare()">
    </div>
    User 1: <pre>{{user1 | json}}</pre>
    User 2: <pre>{{user2 | json}}</pre>
    Equal: <pre>{{result}}</pre>
  </form>
</div>
</file>
<file name="script.js">
     angular.module('sample', ['ngMaterial']).controller('ExampleController', ['$scope', function($scope) {
         $scope.user1 = {};
         $scope.user2 = {};
         $scope.result;
         $scope.compare = function() {
          $scope.result = angular.equals($scope.user1, $scope.user2);
     };
}]);


</file>
</example>

Below is the error that I get.

angular.js:12330 Error: [$injector:modulerr] Failed to instantiate module sample due to:
Error: [$injector:modulerr] Failed to instantiate module ngMaterial due to:
Error: [$injector:modulerr] Failed to instantiate module material.components.fabSpeedDial due to:
TypeError: Cannot read property 'apply' of undefined

If i remove 'ngMaterial' as depenedency, this example block works absolutely fine. I am using Angular 1.4.3 and Angular-material 1.0.5. Please help.

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