javascript - getting a method as a json data in angularjs and how to use it in html view -


i have been working on ui chart takes data json , show it.. json file job.json demo link hardcoded want dynamic getting data database json link

{          "days": [{            "dayname": "sun,23 aug 2015",            "date": "2015-08-23",            "hours": "hoursarray()"          }, {            "dayname": "mon,24 aug 2015",            "date": "2015-08-24",            "hours": "hoursarray()"          }, {            "dayname": "tue,25 aug 2015",            "date": "2015-08-25",            "hours": "hoursarray()"          }, {            "dayname": "wed,26 aug 2015",            "date": "2015-08-26",            "hours": "hoursarray()"          }]        

in hoursarray() method while using in code expression not giving result when giving hardcoded value in angularjs controller. please if tell me how pass hoursarray() method in angularjs

the code angularjs file is

var myapp = angular.module("mydashboardapp", []);  var array24 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23];  myapp.controller("maincontroller", function($scope,$http) {  	  		$http.get("job.json")    .success(function(response) {  $scope.big = response;  });  	  	$scope.addition = function(index, add) {  		return number(index) + number(add);  	};  });    $(document).ready(function() {  	$("#scheduleapp").schedule();  });  function hoursarray(from) {  	var output = [];  	for (var in from) {  		output.push(zeropreffix(i));  	}  	return output;  }    function zeropreffix(i) {  	return (string(i).match(/^[0-9]$/)) ? "0" + : i;  }    function flighttime( hours) {  	var output = [];  	for (var in hours) {  		if (i != 0 && % 2 == 0) {  			output.push({  				breakhours : {  					station : "cok"  				}  			});  		} else {  			output.push({  				timing : {  					real : {  						start : zeropreffix(i) + ":00",  						end : zeropreffix(i) + ":59",  						code : "ek531"  					},  					actual : {  						start : zeropreffix(i) + ":00",  						end : zeropreffix(i) + ":59",  						code : "ek531"  					}  				}  			});  		}    	}  	return output;
html file

                                        <div class="schedule-row border-t-dark-blue-fade">                                             *<span class="schedule-cell schedule-hours" ng-repeat="hour in dayitem.hours" data-col-hours="{{hours}}"> {{hour}} </span>*                                         </div> 


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -