Showing posts with label AngularJS. Show all posts
Showing posts with label AngularJS. Show all posts

Tuesday, February 16, 2016

Menu bar in Angualr JS

We are using Angular’s directives to set and read the active variable

<style>
*{
margin:0;
padding:0;
}

body{
font:15px/1.3 'Open Sans', sans-serif;
color: #5e5b64;
text-align:center;
}

a, a:visited {
outline:none;
color:#389dc1;
}

a:hover{
text-decoration:none;
}

section, footer, header, aside, nav{
display: block;
}

/*-------------------------
The menu
--------------------------*/

nav{
display:inline-block;
margin:60px auto 45px;
background-color:#5597b4;
box-shadow:0 1px 1px #ccc;
border-radius:2px;
}

nav a{
display:inline-block;
padding: 18px 30px;
color:#fff !important;
font-weight:bold;
font-size:16px;
text-decoration:none !important;
line-height:1;
text-transform: uppercase;
background-color:transparent;

-webkit-transition:background-color 0.25s;
-moz-transition:background-color 0.25s;
transition:background-color 0.25s;
}

nav a:first-child{
border-radius:2px 0 0 2px;
}

nav a:last-child{
border-radius:0 2px 2px 0;
}

nav.home .home,
nav.projects .projects,
nav.services .services,
nav.contact .contact{
background-color:#e35885;
}

p{
font-size:22px;
font-weight:bold;
color:#7d9098;
}

p b{
color:#ffffff;
display:inline-block;
padding:5px 10px;
background-color:#c4d7e0;
border-radius:2px;
text-transform:uppercase;
font-size:18px;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>

HTML

 It replaces it with the contents of the variable.

<div id="main" ng-app>


<nav class="{{active}}" ng-click="$event.preventDefault()">



<a href="#" class="home" ng-click="active='home'">Home</a>
<a href="#" class="projects" ng-click="active='Hardware'">Hardware</a>
<a href="#" class="services" ng-click="active='Software'">Software</a>
<a href="#" class="contact" ng-click="active='contact'">Contact</a>
</nav>



<p ng-hide="active">Please click a menu item</p>
<p ng-show="active">You chose <b>{{active}}</b></p>
</div>

Thursday, November 5, 2015

how to selected dropdown value in angularjs

HTML:

<div ng-app>
    <h2>TAsk Details</h2>
    <div ng-controller="TodoCtrl">
        <select ng-model="ddlRooms" ng-options="r.id as r.Name for r in Rooms">
        </select>
        {{$scope.test}}
    </div>
</div>
Angular

function TodoCtrl($scope) {
    $scope.Rooms = [{ Name: 'Toddler', id: 1 },{ Name: 'other', id: 2 }];
    $scope.options = [{ Name: 'other', id: 2 }];
    $scope.ddlRooms = $scope.options[0];

    $scope.test = 'bla';
}

Friday, October 30, 2015

How to create simple textbox value show another html control angular js Script?

 This post textbox value show  same text in h1 tag.

 
Script :

<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>

<div ng-app="">

<table><tr><td>
Enter the Name :</td><td> <input type="text" ng-model="name" placeholder="Enter your name "></td></tr>
<tr><td colspan='2'><h1>Hello {{name}}</h1></td></tr>
</table>
</div>







What is AngularJS?

AngularJS is quickly and efficient to work for developers.
-Extends Hyper text markup Language
-Dynamic webapps
-Its runs single page application like (If you search records in same page)
-Databinding within the pages
- Easy to learn and implementation our Application

We need to know

HTML
Javscript
CSS

Basic in AngularJS
  • Directives, 
  • Expressions,
  • Filters,
  • Modules, 
  • Controllers 
Majorly Used:
  1. Events, 
  2. DOM, 
  3. Forms,
  4.  Input, 
  5. Validation,