Hi, Rahul.
myApp.controller('editcontroller',function ($scope,$http,$routeParams){
console.log($routeParams.Blogid);
});
--
Rafael Bernard Rodrigues Araújo
about.me/rafaelbernard
Analista de Tecnologia | Hospedagem de sites - http://oservidor.com
>
> On Thursday, May 14, 2015 at 5:39:57 AM UTC-4, Rahul Saxena wrote:
>>
>> Hello I m new in angularjs, I didn't know how to get route parameters
>> like
>>
>>
>>
>>
>>
>> *.when('/edit/:Post_id){//Code here}*
>> I want to get this to my controller function.
>>
>> Here is my controller file:
>> var myApp = angular.module("blogapp",[]);
>>
>> myApp.config(['$routeProvider',function($routeProvider){
>>
>> $routeProvider
>> .when('/home',{
>> templateUrl:'home.html',
>> controller:'blogcontroller'
>> })
>> .when('/list',{
>> templateUrl:'list.html',
>> controller:'blogcontroller'
>>
>> })
>> .when('/add',{
>>
>> templateUrl:'add.html',
>> controller:'addcontroller'
>> })
>>
>>
>>
>>
>> * .when('/edit/:Blogid',{ // Want to get this id Blogid to edit
>> controller templateUrl:'edit.html',
>> controller:'editcontroller' })*
>> .otherwise({
>> redirectTo:'/home'
>> });
>>
>> }]);
>>
>>
>> myApp.controller('blogcontroller',function ($scope,$http){
>>
>> $http({method: 'GET' , url: 'getallblog.php'}).success(function(data){
>> $scope.allblog = data;
>> });
>>
>> // DELETE blog HERE
>> $scope.removeRow= function(id){
>>
>>
>>
>> $http.post("removeblog.php",{'id' :
>> id}).success(function(data,status,headers,config){
>> window.location='index.html';
>> console.log("Deleted Successfully");
>>
>> });
>> };
>>
>> // delete blog code ends here
>>
>>
>> });
>>
>>
>> myApp.controller('addcontroller',function ($scope,$http){
>>
>>
>>
>>
>>
>> /// New Post Here
>> $scope.new_post =function(){
>>
>>
>>
>> $http.post("addblog.php" ,{'title' : $scope.title ,'description' :
>> $scope.description }).success(function(data,status,headers,config){
>> window.location='index.html';
>> console.log("inserted Successfully");
>> });
>> };
>>
>>
>>
>> // New Post ends Here
>>
>> });
>>
>> myApp.controller('editcontroller',function ($scope,$http,$routeParams){
>>
>>
>> *// I Want to get Here the Blogid for view the particular id record. *
>> });
>>
>>
>> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>
>>
>> appecite if Anyone help.. Thanks
>>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.