Trying to use angular-moment library. (Not sure if I can add a link to it here). Tried to use it as shown in github repo. Added libraries to the index file, moment, angularMoment and then...
angular.module('chat', ['angularMoment'])
.controller('ChatController', ['$scope', '$location', '$timeout', '$interval', '$filter', 'Authentication', 'Socket', 'Chat',
function($scope, $location, $timeout, $interval, $filter, Authentication, Socket, Chat) {
}]);
But if I try to inject it in myApp, the whole controller just disappears, like it was not there. I suppose it might not be able to resolve angularMoment and leaves the whole controller behind. Tried injecting it into controller, but returns that it cant find angularMomentProvider.
The view where im using this controller:
<section ng-controller="ChatController" ng-init="getMessages()">
<div class="page-header">
<h1>Chat</h1>
</div>
<div class="col-md-4">asd</div>
<div class="col-md-6" style="background-color: hsla(30, 1%, 52%, 0.02); border-radius: 1%;">
<small>{{ userWriting }}</small>
<div scroll-to="isAtTop" style="padding: 10px 10px 0px; ">
<ul class="list-unstyled">
<li class="" ng-repeat="message in messages">
<small class="pull-right text-muted" style="color: lightgrey;"><span class="glyphicon glyphicon-time"></span> {{ message.created | timeDuration }}</small>
<span style="font-size: 14px; font-weight: 700;">{{ message.user.username }}</span>
<p style="font-size: 14px">{{ message.message }}</p>
</li>
</ul>
</div>
<form name="chatForm" class="form-horizontal" ng-submit="sendMessage()" novalidate>
<fieldset>
<div class="input-group" style="margin-bottom: 15px">
<input name="message" type="text" data-ng-model="message" id="message_input" class="form-control" placeholder="Message" [required="test"] ng-keypress="keypressEvent()" ng-model-options="{ debounce: 2000 }">
<span class="input-group-btn">
<button class="btn btn-default">Send</button>
</span>
</div>
<div data-ng-show="error" class="text-danger">
<strong data-ng-bind="error"></strong>
</div>
</fieldset>
</form>
</div>
<div class="col-md-2">
asd
</div>
</section>
What am I doing wrong? What should I do to make it work? Thanks