Skip to main content

Anjular Js Examples

Anjular Js Examples:


<!DOCTYPE html>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<body>
<!-- <span ng-app="">
<input type="text" ng-model="test">
{{test}}
</span> -->
<!-- <span ng-app="">
<input type="text" ng-model="koti">
<span ng-bind="koti"></span>
</span> -->


<!-- <div ng-app="" ng-init="location='bangalore'">
<p>Location is :<span ng-bind="location"></span></p>

</div>

<div ng-app="">
{{50-50}}
</div> -->




===========
<!-- <div ng-app="koti"  ng-controller="raogaru">
<p>name :<span><input type="text" ng-model="name" id="check"></span></p>
<p>location :<span><input type="text"  ng-model="loc"></span></p>   
fullname {{name+""+loc}}                           
</div>
<span id="checkto">Test </span> -->

<script>
// $('#check').click(function()
// {
    //alert("sam");
// var a = angular.module('koti',[]);
// a.controller('raogaru',function($scope)
// {
// $scope.name='kotesh';
// $scope.loc='rao';
// $('#check').click(function()
//  {
//     alert($(this).val());
//     });
// });
// // });

</script>


<!--
<div ng-app="" ng-init="x=3;y=56;z=99">
{{x+y-z}}
<span ng-bind="x+y"> </span>
</div>
 -->

<!--  <div ng-app="" ng-init="first='koti';last='rao'">

 <span ng-bind="first+last"></span>
 </div>
 -->
<!-- <div ng-app="" ng-init="sam={add:'bangalore',loc:'karnataka'}">
<span ng-bind='sam.add+sam.loc'></span>
</div> -->

<!-- <div ng-app="" ng-init="x=['koti','sam','anju']">

<span ng-bind="x[1]">

</div> -->

<!-- <div ng-app="" ng-init="sam='koti'">
<input type="textarea" ng-model="sam">
<span>{{sam}} </span>
</div> -->
<!-- <div ng-app="" ng-init="k=['sam','swati']">
<span ng-repeat="z in k">
{{z}}
</span>

</div> -->

<!-- <div ng-app="" ng-init="names=[{name:'koti',loc:'bng'},{name:'sam',loc:'mlg'}]">
<span ng-repeat="k in names">
{{k.name+','+k.loc}}
</div> -->



<!-- <div ng-app="testapp" ng-controller="sample">
<input type="text" ng-model="name">
<input type="text" ng-model="loc">
{{name+','+loc}}
</div>
 -->
<script>
// var my = angular.module('testapp',[]);
// my.controller('sample',function($scope){

// $scope.name = "koti";
// $scope.loc = "rao"
// });

</script>
<!-- <div ng-app="sample" ng-controller="testing">
<input type="text" ng-model="firstname">
<input type="text" ng-model="lastname">

{{full_name()}}
</div> -->

<script>
// var m = angular.module('sample',[])
// m.controller('testing',function($scope)
// {
// $scope.firstname = "koti";
// $scope.lastname ="raogaru";
// $scope.full_name = function()
// {
//     return $scope.firstname+","+$scope.lastname
// }

// });

</script>
<!-- <div ng-app="myapp" ng-controller="koti">
<input type="number" ng-model="pric">
<input type="number" ng-model="cost">
{{(pric*cost)| currency}}
</div>
 -->
<script>
// var a = angular.module('myapp',[]).controller('koti',function($scope)
// {
// $scope.pric= 12;
// $scope.cost =13;

// })

</script>

<!-- <div ng-app="" >
<input type="textarea" ng-model="name">
{{name | lowercase | uppercase | currency}}
</div> -->


<!-- <div ng-app>
<input type="text" ng-model="test">
{{test}}
</div> -->

<!-- <div ng-app="" ng-init="sample=['3','2','1']">

<span ng-bind="sample"></span>
<span ng-repeat="s in sample || filter:s |orderby:s">
{{s}}
</span>
</div> -->


<!-- <div ng-app="samantha" ng-controller="sample">
<span ng-repeat='x in names'>
{{ x.Name + ', ' + x.Country }}
</span>
</div> -->
<script>
// angular.module('samantha',[]).controller("sample",function($scope,$http)
// {
// $http.get("http://www.w3schools.com/angular/customers.php").success(function(response) {$scope.names = response.records;});
// });

</script>

<!-- <div ng-app="swathi" ng-controller="anushka">
<table>
<tr ng-repeat = "x in names | orderBy : 'Country'">
  <!--  <td> {{$index+1}}</td>
    <td> {{x.Name}} </td>
    <td>{{x.Country | uppercase}} </td> -->
<!-- <td ng-if="$odd" style="background-color:#f1f1f1">{{ x.Name }}</td>
<td ng-if="$even">{{ x.Name }}</td>
<td ng-if="$odd" style="background-color:#f1f1f1">{{ x.Country }}</td>
<td ng-if="$even">{{ x.Country }}</td>
</tr>
</table>

</div> -->
<script>
// angular.module("swathi",[]).controller("anushka",function($scope,$http)
// {
// $http.get("http://www.w3schools.com/angular/customers.php").success(function(response)
// {
//     $scope.names = response.records;

//     // body...
// })
// })
</script>

<!-- <div ng-app="" ng-init="mySwitch=true">
<button ng-disabled="mySwitch">Click Me!</button>
<input type="checkbox" ng-model="mySwitch">
{{mySwitch}}
</div> -->

<!-- <div ng-app="">
<span ng-show="true"> Iam kotesh</span>
<span ng-show="false"> hello</span>
<span ng-hide="true"> Iam kotesh</span>
<span ng-hide="false"> hello</span>
</div> -->
<!-- <div ng-app="">
<button ng-click="count=count+1">welcome kotesh</button>{{count}}
</div>
 -->

<!--  <div ng-app="koti" ng-controller="rao">
<button ng-click="togle()">Button </button>
<p ng-show="disp">
<input type="text" ng-model="firstname">
<input type="text" ng-model="lastname">
</p>
 </div> -->
 <script>
//  angular.module("koti",[]).controller("rao",function($scope)
//  {
// $scope.firstname="kotesh";
// $scope.lastname = "rao";
// $scope.disp = true;
// $scope.togle = function() {
// $scope.disp = !$scope.disp;
// }
//  });

 </script>

<!--  <div ng-app="rao" ng-controller="test">
<form novalidate>
<input type="text" ng-model="user.first">
<input type="text" ng-model="user.second">
<button ng-click="reset()">Reset</button>
</form>
 </div> -->

 <script>
 // angular.module("rao",[]).controller("test",function($scope)
 // {
 // $scope.master = {first:"kotesh",second:"rao"};
 // $scope.user = angular.copy($scope.master)   
 // });
 </script>


 <form ng-app="test" ng-controller="userform" name="myForm" novalidate>
 <p>user
 <input type="text" name="user "ng-model="user" required>
 <span style="color:red" ng-show="myForm.user.$dirty && myForm.user.$invalid">
  <span ng-show="myForm.user.$error.required">Username is required.</span>
 </p>
 <p>email
 <input type="emil" name="email" ng-model="email" required>
  <span style="color:red" ng-show="myForm.email.$dirty && myForm.email.$invalid">
  <span ng-show="myForm.email.$error.required">Email is required.</span>
  <span ng-show="myForm.email.$error.email">Invalid email address.</span>

 </p>
 <p>
 <input type="submit" ng-disabled="myForm.user.$dirty && myForm.user.$invalid ||
  myForm.email.$dirty && myForm.email.$invalid">
 </p>
 </form>
 <script>
var app = angular.module("test", []);
app.controller("userform", function($scope) {
    $scope.user = 'John Doe';
    $scope.email = 'john.doe@gmail.com';
});
</script>
</body>
</html>




Comments

Popular posts from this blog

Gem::LoadError (Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).?

Gem::LoadError (Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).) In rails?


1)change the gemfile in mysql version
 gem 'mysql2'

2)Change to mysql2 version
 gem 'mysql2','0.3.20'

Get user accessing ip address in rails?

Get user accessing ip address rails?

request.ip ->returns the ip, whether is is a local proxy ip (localhost address) or not.
*request.remote_ip -> is smarter and gets the ip address of the client outside of local proxies.
3)If you are using apache in front of a mongrel, then remote_ip will return the source address of the request, which in this case will be local host because the Apache web server is making the request, so instead put this in your controller:

@remote_ip = request.env["HTTP_X_FORWARDED_FOR"]

PayUMoney Integration in Ruby on Rails

PayUMoney Integration in Ruby on Rails


Generating Cheksum in Payu
   Hash or Checksum
= sha512(key|txnid|amount|productinfo|firstname|email|u
df1|udf2|udf3|udf4|udf5||||||salt)



Controller Code Will be
def payumoney
  @key = "gtKFFx"
  @salt =  "eCwWELxi"
  val = "#{key|txnid|amount|productinfo|firstname|email|u
df1|udf2|udf3|udf4|udf5||||||#{@salt}"
 @checksum = Digest::SHA512.hexdigest("#{val}")
end

<form action="https://test.payu.in/_payment" method='post' id='sub'  >
    <input type="hidden" name="key" value="<%=@key%>">
    <input type="hidden" name="hash" value="<%=@checksum%>">
    <input type="hidden" name="txnid" value="TXN1234">
    <input type="hidden" name="amount" value="200">
    <input type="hidden" name="firstname" value=&quo…