Hi I am new to angularjs I was wondering if were possible to send stuff that was already loaded in the view from json back to the controller. What I am trying to do is to send the letters back to a controller and create a way to iterate over them with a intervale then change the style of each controller right now I am stuck because I can't get the ng-module="single" back to the interval controller name
Here is the view
<!DOCTYPE html>
<html lang="en-us" ng-app="App">
<body ng-controller="mainController" ng-click="textArea = textArea + 1">
<div ng-controller="clickController">
<div class="container">
<div ng-controller="intervalController">
<ul class="general_button"ng-repeat="letter in language[0].rows">
<button type="button" ng-model="single += single" class="btn btn-info" ng-repeat="single in letter">
{{single}}
</button>
</ul>
<div >
<h1 ng-mousemove="textArea = textArea + 1">Mouse over me!</h1>
<label for="inputlg">input-lg</label>
<input class="form-control input-lg" id="inputlg" type="text" value="{{ textArea }}">
</div>
</div>
</div>
</div>
</body>
</html>
Here are the controllers
var App = angular.module('App', []);
var theLanguage = 'english';
App.controller('mainController', function($scope, $http,$log) {
$http.get(theLanguage + '.json')
.then(function(res){
$scope.language = res.data;
});
$log.debug('Hello Debug!');
});
App.controller('intervalController', function($scope, $log) {
this.$log = $log;
var name = $scope.single;
$log.log(name);
$log.log('Hello World!');
});
App.controller('clickController', function($scope) {
});
and here is the Json
[{
"rows":[[
"a",
"e",
"u",
"i",
"o",
"y"
],
[
"b",
"c",
"d",
"f",
"g"
],
[
"h",
"i",
"j",
"k",
"l"
],
[
"m",
"n",
"p",
"q",
"r"
],
[
"s",
"t",
"v",
"w",
"x z"
]
]}]
Thank you in advance for your help any suggestions about how to do this a better way would also be appreciated.