Skip to content

Instantly share code, notes, and snippets.

View kneerunjun's full-sized avatar
🖥️
Working for the love of programming

kneerunjun kneerunjun

🖥️
Working for the love of programming
View GitHub Profile
@kneerunjun
kneerunjun / bradacasttimeout.html
Created November 7, 2015 04:24
$broadcast with appropriate timeout interval
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body ng-app="loginApp" ng-controller="$ctrlMain">
<parent>
<child flag="flagOnParent"></child>
<child flag="flagOnParent"></child>
<child flag="flagOnParent"></child>

Getting the choices for selection

I may not have too many answers for the question - "whats the best way of gettin your selection option choices ?" Programming selection options with Angular may not be a taks at all , but a couple of things that may be a bit tricky..

  • Timing of getting the choices downloaded from the service
  • Caching the choices once downloaded for multiple selection options avilable

Timing of getting the choices

I assume you want to download the choices from server maybe or a store across the http request. This is what creates the timeline catch. while your request is getting the choices, which are not many (if they are , you would not be using the selection option atall) you have nothing the populate the drop down. And when the choices are you woudl then want to connect and make it available for the users to pick from them.

var myapp = angular.module("myapp",[]).config(function($routeProvider){
  $routeProvider
  //this is the just the login view
  .when("/login", {templateUrl:"/app/login/login.html", controller:"loginController"})
  //this would devise the help page for the login, notice how the help is placed in a position for the virtual folders
  .when("/login/html", {templateUrl:"/app/login/help.html", controller:""}) 
});

Help doucmentation would be in the same virtual folder as that of the view. Available as the progressive url from the view. Now what we need is a directive that would be manifested on each page so as to move the absolute url.

  <emp-label append-text="Text that you want to appear before the emp details: "></emp-label>
(function () {
    var empLabel = angular.module("enggedu").directive("empLabel", function () {
        return {
            restrict: "E",
            replace: true,
            scope: true,
@kneerunjun
kneerunjun / balloonpop.md
Last active November 23, 2015 05:19
getting to know how the balloon pop really works

Inclusions and references

<script data-require="jquery@*" data-semver="2.1.4" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script data-require="angular.js@1.4.7" data-semver="1.4.7"
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js"></script>
<link data-require="bootstrap@*" data-semver="3.3.5" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
    
<!--from the intranet cdn here is the inclusion in your main html page-->
<script src="http://vpunplepun2-01:8082/balloonpop/balloonpop.js"></script>

Your controllers have manifestation but not the services

<body ng-app="myApp" ng-controller="mainController">
<!-- here you go the scope has the existence since the controller has manifestation -->
</body>
var myApp  = angular.module("myApp", []);
var mainController = myApp.controller("mainController", function($scope, myService){
  //scope has a purpose and that is to link the object model to the html there in the view
@kneerunjun
kneerunjun / evalservice.md
Last active November 28, 2015 06:28
describes how one would have to use the eval in gettin literal boolean values bound on scope

Faultline

Simple isolated scope directive fails to bind the literal boolean value from the attributes to the scope. This is un-intuitive.

<body ng-app="myApp" ng-controller="mainController">
  <my-directive visibility='true'></my-directive>
</body>
//and here is the definition of the application and the directive
@kneerunjun
kneerunjun / inplaceselect.md
Last active November 29, 2015 04:10
Complete description on how to use the inplace-select control that helps you have a drop down for edit. With configurable services to download the choices from this is quite handy

Requirement

  1. We need a control, or for that matter a self sufficient directive that would help us select choices onto a specific field of an object, or the object itself
    • The control comes to play on requirement of the user to edit the value on the object
    • The control once done selecting should switch back to only displaying the value
  2. Such a multi option select control to have a configuration that downloads the choices once for all instances of the control
  3. This control ought be configurable for the services it uses to get the choices from. The control has to be agostic of the domain and since the services are attached to the domain it would mean the services shoould be dynamically injected in the directives

Inclusions

  1. Bootstrap.css 3.xx : the control uses bootstrap controls formatting , so to make it appear like one of those flat contemporary controls you would have to include Bootstrap css styles
@kneerunjun
kneerunjun / 01ratingcontrol.html
Last active January 3, 2016 10:47
quick rating control for feedback activity
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Demostraiton for the rating control</title>
<script src="Scripts/jquery-2.1.4.min.js"></script>
<script src="Scripts/bootstrap.min.js"></script>
<script src="Scripts/d3/d3.js"></script>
<script src="Scripts/angular.min.js"></script>
</head>
<body>
@kneerunjun
kneerunjun / attrrouting.cs
Last active January 3, 2016 13:31
understanding attribute routing in MVC4 ASP
[RoutePrefix("home")]
[Route("{action=index}")] //this would assign the default action from the controller
public class HomeController:Controller
{
//here despite not giving route attribute the controller woudl still pick up this action as the default
public ActionResult Default(){
}
[Route("users")]
//route /home/users