Skip to content

Instantly share code, notes, and snippets.

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
https://codepen.io/zenius/pen/qGgobQ
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"]);
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
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 {
const Feact = {
createElement(type, props, children) {
const element = {
type,
props: props || {}
};
if (children) {
element.props.children = children;
}
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
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.
input elements
select elements
button elements
textarea elements
ng-blur
ng-change
ng-click
ng-copy
ng-cut
ng-dblclick
ng-focus
ng-keydown
ng-keypress
ng-keyup