angucomplete-alt module not working when ngRoute module is added in angularjs
app.config.js :
'use strict';
angular.module('myApp')
.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
$routeProvider.
when('/EBSAjsN', {
templateUrl: 'EBSAjsN/Views/login.html',
controller: 'loginController'
})
.when('/dashboard', {
templateUrl: 'EBSAjsN/Views/dashboard.html',
controller: 'dashboardController'
})
.when('/receipt', {
templateUrl: 'EBSAjsN/Views/receipt.html',
controller: 'receiptController'
})
.when('/issue', {
templateUrl: 'EBSAjsN/Views/issue.html',
controller: 'issueController'
})
.otherwise({
redirectTo: '/EBSAjsN'
});
$locationProvider.html5Mode(true);
}]);
app.module.js :
angular.module('myApp', ['ngRoute', 'ngStorage', 'angucomplete-alt']);
receipt.html :
<link href="http://stagingserver:85/EBSAjsN/Styles/css/angucomplete-alt.css" rel="stylesheet" />
<script src="http://stagingserver:85/EBSAjsN/Scripts/js/angucomplete-alt.js"></script>
<form class="form-inline my-0 ml-auto">
<!--<input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">-->
<angucomplete-alt id="txtinvnumber" placeholder="Search Invoice" pause="100"
selected-object="Selectedinvoice" local-data="warehouse" search-fields="InvoiceNo"
title-field="InvoiceNo" minlength="1" input-class="form-control mr-sm-2" match-class="highlight"
ng-click="Search()" />
<!--<button class="btn btn-secondary my-2 my-sm-0 " type="submit">Search</button>-->
</form>
receipt.js :
angular.module('myApp')
.controller('receiptController', function ($scope, $sessionStorage, $http, $window, $location) {
//to get username from the login page and display it in this page
var user = JSON.parse($sessionStorage.SessionMessage.replace('[', '').replace(']', ''));
user.username = user.username.substring(0, 1).toUpperCase() + user.username.substring(1, user.username.length);
$scope.username = user.username;
//alert($scope.username);
//to display count of receipt and issue
$scope.count = null;
$http.get("http://stagingserver:85/EBSApi/api/Warehouse/GetInvoiceCount")
.then(function (response) {
$scope.count = JSON.parse(response.data);
$scope.count.Receipt = $scope.count[0].Receipt;
$scope.count.Issue = $scope.count[0].Issue;
})
//to get all invoices and display it in autocomplete autobox
$scope.warehouse = null;
$scope.Selectedinvoice = null;
var get = $http({
method: "GET",
url: "http://stagingserver:85/EBSApi/api/Warehouse/GetAllInvoices",
dataType: 'json',
d: {},
headers: { "Content-Type": "application/json" }
});
get.then(function (d, status) {
$scope.warehouse = JSON.parse(d.data);
});
//to select and display the selected invoice number details and its total pallets and nos.
$scope.mydata = null;
$scope.tdata = null;
$scope.Search = function () {
debugger;
$http.get("http://stagingserver:85/EBSApi/api/Warehouse/GetInvoiceDetails?invoiceno=" + $scope.Selectedinvoice.originalObject.InvoiceNo + "")
.then(function (response) {
$scope.mydata = JSON.parse(response.data);
});
$http.get("http://stagingserver:85/EBSApi/api/Warehouse/GetTotalQuantity?invoiceno=" + $scope.Selectedinvoice.originalObject.InvoiceNo + "")
.then(function (response) {
$scope.item = "";
$scope.tdata = JSON.parse(response.data);
$scope.tdata.TotalQty = $scope.tdata[0].TotalQty;
$scope.tdata.TotalPallets = $scope.tdata[0].TotalPallets;
});
};
});