Reputation: 75
I am initiating me in AngularJS and I have a doubt beginner.
I have defined my main module with several units already displayed on screen . I happen to have another module but do not know how to put it in the main module , because if I put it as a dependency , then the view gives me error. I have also doubts how to apply various ngcontroller in html, because the same thing happens , if I put the main everything works fine ... when I put the second module , and nothing works ... I guess that is dependence.
I leave my code and you will understand better. Thank you very much.
JS code ----------------------------------------------------
var app = angular.module('frutariaApp',
['ngMaterial', 'ngMessages']);
app.controller('AppCtrl', function($scope, $mdDialog, $mdMedia) {
(this is the part I don't know to implement over de main module).
angular.module('acc-test', ['ui.bootstrap']);
function AccordionCtrl($scope) {
$scope.oneAtATime = true;
}
});
HTML---------------------------
<html ng-app="frutariaApp">
<body ng-controller="AppCtrl">
<div class="accordion-test" ng-controller="AccordionCtrl"> //Ihave problem with this too
<accordion close-others="oneAtATime">
<accordion-group is-open="falsee">
<accordion-heading>
Number <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': isopen, 'glyphicon-chevron-right': !isopen}"></i>
</accordion-heading>
<ul>
<li><a href="#">0</a></li>
<li>1</li>
</ul>
</accordion-group>
</accordion>
</div>
</body>
</html>
Thanks
Upvotes: 0
Views: 31
Reputation: 171679
In order to use modules other than the main one they must be injected as a dependency of another module.
Try injecting your 'acc-test'
module into the main app module
var app = angular.module('frutariaApp', ['ngMaterial', 'ngMessages', 'acc-test']);
Upvotes: 1