sql - Making an AJAX request with AngularJS -


i started angularjs app learn more js framework, i'm confused in things working sql want little make show on click table.

what im trying make request database , fill table ng-repeat, show sliding effect when click button.

i dont have idea how sql query , insert controller in angularjs, please help.

database movies table:

|--id--|------text------|-----year-----| |______________________________________| |--1---|----avengers----|-----2012-----| |--2---|------mama------|-----2013-----| 

i want pass angularjs like:

$scope.movies = [ {text:'mama', year:'2013',id:2}, {text:'avengers', year:'2012',id:1}]; 

this should started. it's simple controller data-binding property named myscopedata. code uses $http object in angular make ajax request php retrieve data database. scope variable myscopedata gets set , updates view.

html

<div ng-app="myapp">     <div ng-controller="maincontroller">         {{myscopedata}}             </div> </div> 

javascript

var app = angular.module('myapp',[]);  app.controller('maincontroller',function($scope,$http){     $http({method:'get',url:'movies.php'}).success(function(data){         $scope.myscopedata = data;     });   }); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -