0

I don't know why, but i have two duplicate request from my controller "AuditionCtrl" to database. Please help understand this trouble.

here you can see two get request enter image description here Github my project https://vonoprienko@bitbucket.org/vonoprienko/iknowit.git

Ahmad Sharif
  • 4,141
  • 5
  • 37
  • 49
Vasiliy Ivanov
  • 142
  • 2
  • 10

1 Answers1

2

Duplicate: function called twice inside angularjs controller

This is your audition.html

<div class="container-fluid fill" ng-controller="AuditionCtrl">
    <div class="row">
        <div class="col-lg-12 col-md-12 col-sm-12">
            <p>Welcome to exercise listening and typing!</p>
            <br>
            <button type="button" class="btn btn-default" ng-click="readbtn();">Play</button>
            <br>
            <input type="text" ng-model="userAnswer" placeholder="Type heard">
            <button type="button" class="btn btn-default" ng-click="nextWord();">Next word</button>
            <button type="button" class="btn btn-default" ng-click="skipWord();">Skip</button>
            <br>
            <label id="labelMessage" ng-bind="showCorrect"></label>
        </div>
    </div>
</div> 

And this is a portion of your app.js

.when('/audition', {
        templateUrl: 'partials/audition.html',
        controller: 'AuditionCtrl',
        access: {
          requiredLogin: false
        }

As mentioned in the answer. You have attached your controller to multiple elements which leads to Angular calling digest on the controller twice.

Community
  • 1
  • 1
chatuur
  • 1,207
  • 13
  • 20