Currently, while developing a web app and implementing routes, I encountered an issue with my ngRoute. Before adding ngRoute as a dependency to myApp, the viewproducts were functioning properly. However, after integrating ngRoute, I am now seeing {{product.name}} {{product.company}} instead of the actual values.
Module CODE :
var myApp = angular.module('myApp', ['ngRoute']);
myApp.config(function($routeProvider){
$routeProvider.
when('/addproduct', {
templateUrl:'addproduct.html',
controller:'myController'
})
});
Controller CODE :
myApp.controller("myController",function($scope,$http){
$scope.insertData = function(){
$http.post("addProduct.php",{'pname': $scope.productname,'company': $scope.company,'price': $scope.price,'quantity':$scope.quantity})
.success(function(data,status,headers,config){
$scope.successMessage = "Inserted Successfuly!";
});
}
});
HTML CODE:
<!DOCTYPE html>
<html ng-app="myApp">
<!-- Other HTML elements remain unchanged -->
</body>
<!-- Additional script sources added in this section -->
</html>