Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

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

@BalachanderJ

Description

@BalachanderJ

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions