Posts

Showing posts from April, 2017

Angular Js Day2 - $ watch $watchcollection, $watchgroup , ng-change

$watch keeps track of a variable and its value   <div ng-controller="mycontroller"> <input ng-model="a"> <div> {{ b }}</div> </div> app.controller('mycontroller',function(){ $scope.a=1; $scope.b=2; }) whenever a databinding with the scope variable is created , a $watch will automatically be created by the angular js framework $watch -a:1 and  $watch -b:2, And this will be used by the digest cycle . Since C is not used in any databinding , so $watch is not created for variable c. If the value gets changes for those variable, angular performs necessary updates to the DOM elements With the help pg $watch custom functions can be created which are called $watchListeners and this gets executed as soon a the value of the variables is changed They are mainly used for databinding and angular Js constantly uses watchers  behind the scene number of watchers should be kept less the 2000 There are number of ways to get

Angular Js Practice Day1

Custom Directives Directive are of various types : Componenets - Containes its own HTML elements , Decorators - Enhances functionality of existing cutomers ,Templating - Which manupulate the DOM elements and have its own templating.A component oriented directivs return html  in the form of template Directive with different html template ---------------------------------------------------------------------------------------------------------------------- html <div ng-controller="CustomDirectivesController2">             <h2> Customer Directive2 </h2>             <div>                 <input type="text" ng-model="search">                 <button ng-click="getTheEmployee()">Search</button>                             </div>             <div  employee-details ng-if="empId != undefined"></div>                                             </div> employee-de

Mvc and WebApi Videos

Persisting data between different elements in MVC with View Bag, ViewData,TempData,Session Sending data betweeb controller,View to another view  we use ViewData and ViewBag, Data sending from one ActionResult to another we use TempData, Data sending between view to controller we use query string,Hidden fields,    Session variables of ASP.NET can also be used to get the data through out all the entities https://www.youtube.com/watch?v=yq1N7zfZTBo

Authentication and Authorization in Web API -Part1

Image
The Authentication technique used mainly by token based with OWIN, Step was to register a user , We created a appliction form to submit the user credentials to the WEB API Post Mehtod and saved in the database . We have built  a repository class which interacts with the database and gives the required result-set when requested for , We have also introduced a Business Layer which handles the business logics and acts as  model for the controller . The implementations of the Authentication and Authorization is done from this site . http://bitoftech.net/2014/06/01/token-based-authentication-asp-net-web-api-2-owin-asp-net-identity/ The Controller Class using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using WebApiDemo.Models; namespace WebApiDemo.Controllers {     public class EmployeeController : ApiController     {   [Authorize]         [HttpGet]         public IEnumerable<Employee>