Tutorial by Examples: direct

import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <h1>Angular 2 App</h1> <p>Component is directive with template</p> ` }) export class AppComponent { }
<div *ngFor="let item of items">{{ item.description }}</div> <span *ngIf="isVisible"></span>
import {Directive, ElementRef, Renderer} from '@angular/core'; @Directive({ selector: '[green]', }) class GreenDirective { constructor(private _elementRef: ElementRef, private _renderer: Renderer) { _renderer.setElementStyle(_elementRef.nativeElement, 'color', 'gree...
The Application directive defines application-specific attributes. It is provided at the top of the global.aspx file. The basic syntax of Application directive is: <%@ Application Language="C#" %> The attributes of the Application directive are: AttributesDescriptionInheritsThe...
The control directive is used with the user controls and appears in the user control (.ascx) files. The basic syntax of Control directive is: <%@ Control Language="C#" EnableViewState="false" %> The attributes of the Control directive are: AttributesDescriptionAutoEv...
The Implement directive indicates that the web page, master page or user control page must implement the specified .Net framework interface. The basic syntax for implements directive is: <%@ Implements Interface="interface_name" %>
The Master directive specifies a page file as being the mater page. The basic syntax of sample MasterPage directive is: <%@ MasterPage Language="C#" AutoEventWireup="true" CodeFile="SiteMater.master.cs" Inherits="SiteMaster" %>
The Import directive imports a namespace into a web page, user control page of application. If the Import directive is specified in the global.asax file, then it is applied to the entire application. If it is in a page of user control page, then it is applied to that page or control. The basic synt...
The MasterType directive assigns a class name to the Master property of a page, to make it strongly typed. The basic syntax of MasterType directive is: <%@ MasterType attribute="value"[attribute="value" ...] %>
The Page directive defines the attributes specific to the page file for the page parser and the compiler. The basic syntax of Page directive is: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Trace="tr...
The OutputCache directive controls the output caching policies of a web page or a user control. The basic syntax of OutputCache directive is: <%@ OutputCache Duration="15" VaryByParam="None" %>
Redirect any naked domain to www.[your_domain].tld: # Start Apache Rewriting engine RewriteEngine On # Make sure you're not already using www subdomain # and that the host string is not empty RewriteCond %{HTTP_HOST} !^$ RewriteCond %{HTTP_HOST} !^www\. # We check for http/https connection ...
Bash indirection permits to get the value of a variable whose name is contained in another variable. Variables example: $ red="the color red" $ green="the color green" $ color=red $ echo "${!color}" the color red $ color=green $ echo "${!color}" the ...
{ echo "contents of home directory" ls ~ } > output.txt
superman-directive.js angular.module('myApp', []) .directive('superman', function() { return { // restricts how the directive can be used restrict: 'E', templateUrl: 'superman-template.html', controller: function() { this.message = "I'm superman!&qu...
Asynchronously var fs = require('fs'); fs.stat('path/to/file', function(err) { if (!err) { console.log('file or directory exists'); } else if (err.code === 'ENOENT') { console.log('file or directory does not exist'); } }); Synchronously here, we must wr...
AngularJS directives are what controls the rendering of the HTML inside an AngularJS application. They can be an Html element, attribute, class or a comment. Directives are used to manipulate the DOM, attaching new behavior to HTML elements, data binding and many more. Some of examples of directives...
One of the uses of recursion is to navigate through a hierarchical data structure, like a file system directory tree, without knowing how many levels the tree has or the number of objects on each level. In this example, you will see how to use recursion on a directory tree to find all sub-directorie...
1. Target a device by serial number Use the -s option followed by a device name to select on which device the adb command should run. The -s options should be first in line, before the command. adb -s <device> <command> Example: adb devices List of devices attached emulator-55...
Creating a custom directive with isolated scope will separate the scope inside the directive from the outside scope, in order to prevent our directive from accidentally change the data in the parent scope and restricting it from reading private data from the parent scope. To create an isolated scop...

Page 3 of 13