Skip to content

Instantly share code, notes, and snippets.

List<T> class represents the list of objects which can be accessed by index.
. IEnumerable interface is one of the best features of C# language which loops over the collection.
<form name="myForm">
<label>
User name:
<input type="text" name="userName" ng-model="user.name" required>
</label>
<span class="error" ng-show="myForm.userName.$error.required"> Required!</span>
<label>
Last name:
<input type="text" name="lastName" ng-model="user.last" ng-minlength="3" ng-maxlength="10">
</label>
https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
// Save data to sessionStorage
sessionStorage.setItem('key', 'value');
// Get saved data from sessionStorage
let data = sessionStorage.getItem('key');
// Remove saved data from sessionStorage
sessionStorage.removeItem('key');
https://docs.angularjs.org/api/ng/service/$compile
// compile the new DOM and link it to the current
// scope.
// NOTE: we only compile .childNodes so that
// we don't get into infinite loop compiling ourselves
$compile(element.contents())(scope);
https://www.tutlane.com/tutorial/angularjs/angularjs-apply-function
$scope.$apply(function () {
//Your Code.
});
Different ways to use '$apply()'
1.
$scope.$apply(function () {
$scope.val1 = 'tutlane.com';
https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Isolating scope is recommend for passing data between custom directive and its parent scope to prevent unintentionally changing the parent scope.
https://medium.com/@tpstar/angularjs-custom-directive-and-isolated-scope-how-to-pass-data-to-and-from-directive-scope-dd0bc8096bf9
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/
https://github.com/chrisyip/koa-pug#basedir
basedir
If you encounter this error, Error: the "basedir" option is required to use "extends" with "absolute" paths, try to set basedir like this:
const pug = new Pug({
viewPath: 'path/to/views',
basedir: 'path/for/pug/extends'
})