I have a navigation menu with a submenu. My menu has the name of my product group, and it gets data from the JSON code that it selects from my SQL database.
I want to store the "product group identifier" in a variable in order to send it to another page that selects from the product table ProductGroup.productGroupId == Product.ProductGroupId.
I want to display my product name in a submenu. This is my HTML code:
<ul class="sub-menu">
<div ng-app="firstApp" ng-controller="FirstController">
<li ng-repeat="x in result">
<a class="haschild" title="" href="">{{ x.GroupName }}</a>
<ul>
<div ng-controller="ProductController">
<li ng-repeat="x in names">
<a title="" href="">{{ x.name }}</a>
</li>
</div>
</ul>
</li>
</div>
</ul>
My angular app
<script>
var rootApp = angular.module('rootApp', ['firstApp', 'secondApp', 'ProductApp']);
var firstApp = angular.module('firstApp', []);
firstApp.controller('FirstController', function($scope, $http) {
$http.get("select2.php")
.then(function (response) {$scope.result = response.data.records;});
});
var secondApp = angular.module('secondApp', []);
secondApp.controller('SecondController', function($scope, $http) {
$http.get("selectSource.php")
.then(function (response) {$scope.result2 = response.data.records;});
});
var ProductApp = angular.module('ProductApp', []);
ProductApp.controller('ProductController', function($scope, $http) {
$http.get("selectProduct.php")
.then(function (response) {$scope.names = response.data.records;});
});
</script>
source
share