This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://code.visualstudio.com/docs/setup/linux | |
The repository and key can be installed manually with the following script: | |
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg | |
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/ | |
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' | |
Then update the package cache and install the package using: | |
sudo apt-get install apt-transport-https | |
sudo apt-get update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://codepen.io/zenius/pen/qGgobQ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you want to navigate to different pages in your application, but you also want the application to be a SPA (Single Page Application), | |
with no page reloading, you can use the ngRoute module. | |
Applications can only have one ng-view directive, and this will be the placeholder for all views provided by the route. | |
<div ng-view></div> | |
With the $routeProvider you can define what page to display when a user clicks a link. | |
var app = angular.module("myApp", ["ngRoute"]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.lowercase() Converts a string to lowercase | |
angular.uppercase() Converts a string to uppercase | |
angular.isString() Returns true if the reference is a string | |
angular.isNumber() Returns true if the reference is a number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Custom validations in Angular JS are created as directives with a dependency on the ng-model directive. | |
app.directive('evenNumber', function() { | |
return { | |
require: 'ngModel', | |
link: function(scope, element, attr, ctrl) { | |
function isEven(value) { | |
if (parseInt(value, 10) % 2 === 0) { | |
ctrl.$setValidity('even', true); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Feact = { | |
createElement(type, props, children) { | |
const element = { | |
type, | |
props: props || {} | |
}; | |
if (children) { | |
element.props.children = children; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following classes are added to, or removed from, input fields: | |
ng-untouched The field has not been touched yet | |
ng-touched The field has been touched | |
ng-pristine The field has not been modified yet | |
ng-dirty The field has been modified | |
ng-valid The field content is valid | |
ng-invalid The field content is not valid | |
ng-valid-key One key for each validation. Example: ng-valid-required, useful when there are more than one thing that must be validated | |
ng-invalid-key Example: ng-invalid-required |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Input fields have the following states: | |
$untouched The field has not been touched yet. | |
$touched The field has been touched. | |
$pristine The field has not been modified yet. | |
$dirty The field has been modified. | |
$invalid The field content is not valid. | |
$valid The field content is valid. | |
They are all properties of the input field, and are either true or false. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input elements | |
select elements | |
button elements | |
textarea elements |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ng-blur | |
ng-change | |
ng-click | |
ng-copy | |
ng-cut | |
ng-dblclick | |
ng-focus | |
ng-keydown | |
ng-keypress | |
ng-keyup |