This question already has an answer here:
I'm new in angular Js.
Using angular variable in blade file, I'm getting the following error:
Use of undefined constant count - assumed 'count' (View: C:\xampp\htdocs\angularjsLaravelesources\views\testing.blade.php)
My code,
app.js
var app = angular.module('employeeRecords', []);
(function (app) {
"use strict";
app.controller("EmployeesController", function ($scope, $http) {
$http({
method: 'GET',
url: '/employees'
}).then(function (employees){
$scope.employees = employees['data'];
},function (error){
console.log(error);
});
$scope.remaining = function () {
var count = 0;
angular.forEach($scope.employees, function (employee) {
count += employee.done ? 0 : 1;
});
}
});
})(app);
blade.php
<div id="employee" ng-controller="EmployeesController">
<h3 class="page-header">
<small ng-if="remaining()">{{ count }}</small>
</h3>
</div>
help me.
I'm looking forward to a solution.
</div>