Tuesday, 20 April 2021
String Operations
Oracle-Relational Database
- Database in which all data is stored in Relations (Tables) with rows and columns. Each table is composed of records (called Tuples) and each record is identified by a field (attribute) containing a unique value. Every table shares at least one field with another table in 'one to one,' 'one to many,' or 'many to many' relationships. These relationships allow the database user to access the data in almost an unlimited number of ways, and to combine the tables as building blocks to create complex and very large databases.
- The oracle database houses everything There is 1 database which has multiple tablespaces, schemas, Datafiles and segments.
- NOT NULL - Ensures that a column cannot have a NULL value
- UNIQUE - Ensures that all values in a column are different
- PRIMARY KEY - A combination of a NOT NULL and UNIQUE. Uniquely identifies each row in a table
- FOREIGN KEY - Uniquely identifies a row/record in another table
- CHECK - Ensures that all values in a column satisfies a specific condition
- DEFAULT - Sets a default value for a column when no value is specified
- INDEX - Used to create and retrieve data from the database very quickly
- CREATE - to create objects in the database
- ALTER - alters the structure of the database
- DROP - delete objects from the database
- TRUNCATE - remove all records from a table, including all spaces allocated for the records are remove
- RENAME - rename an object
- SELECT - retrieve data from the a database
- INSERT - insert data into a table
- UPDATE - updates existing data within a table
- DELETE - deletes all records from a table, the space for the records remain
- MERGE - UPSERT operation (insert or update)EXEC - call a PL/SQL or Java subprogram
- EXPLAIN PLAN - explain access path to data
- GRANT - gives user's access privileges to database
- REVOKE - withdraw access privileges given with the GRANT command
Angular Forms
- Working with html forms
- Form directives
- Form validation
- Form CSS state classes
- One way and bidirectional form data binding
- Custom form validation
- Form services
- Form validation
- Form directives
- Custom form validation
- Nested forms
- Updating form values
- ngForm directive
- ngModel directive
- Form Validation
- required
- Form css state classes
- ng-untouched / ng-touched
- ng-pristine / ng-dirty
- ng-invalid / ng-valid
- required
- minlength
- maxlength
- pattern
- ngModelChange
- [(ngModel)]
- Create custom validator factory function
- Create custom directive and link factory function
- Register directive as form field validation directive
- required
- minlength
- formGroup directive
- formControlName directive
- formControl directive
- app password strength validator
- FormBuilder
- add validation error messages
- setValue() – to set a new value for an individual control
- patchValue() – to replace values for multiple controls
- Form Array
- Template-driven forms rely on directives in the template to create and manipulate the underlying object model.
- They are useful for adding a simple form to an app, such as an email list signup form.
- They're easy to add to an app, but they don't scale as well as reactive forms.
- If you have very basic form requirements and logic that can be managed solely in the template, template-driven forms could be a good fit.
- Reactive forms provide direct, explicit access to the underlying forms object model.
- Compared to template-driven forms, they are more robust:
- they're more scalable, reusable, and testable.
- If forms are a key part of your application, or you're already using reactive patterns for building your application, use reactive forms
Monday, 19 April 2021
Types of Directives, Built-In Directives, Custom Directives ,Ng-container Introduction to Pipes Built-In ,Pipes Custom Pipes
- Introduction to Directives
- Types of Directives
- Built-In Directives
- Custom Directives
- Ng-container
- Introduction to Pipes
- Built-In Pipes
- Custom Pipes
- Directives are the Document Object Model (DOM) instruction sets, which decide how logic implementation can be done.
- They add additional behavior to elements in your Angular applications.
- These are Typescript class which is declared with decorator @Directive or @Component.
- Based on Type of operation that can be performed , Directives are further classified into:
- Component Directive
- Attribute Directive
- Structural Directive
- Created with @Component Decorator.
- This type of directive is the most common directive type.
- Only type of directives which have a view attached i.e they have a template associated.
- Attribute directives deal with changing the look and behavior of an element, component, or another directive.
- These are used when we want logic or events to change the appearance or behavior of the view.
- When we have a UI element that will be common throughout our app, we can implement an attribute directive and share it across components and modules to avoid repeating the code for the same functionality.
- NgClass - add or remove multiple CSS classes simultaneously based on condition within ngClass.
- NgStyle – used to set multiple inline styles simultaneously, based on the state of the component.
- NgModel—adds two-way data binding to an HTML form element.
- These are responsible for rendering the HTML layout.
- Structural directives shape or reshape the DOM’ structure typically by adding, removing, or manipulating elements.
- Identifier for a structural directives are (*). The asterisk is actually short for ng-template with the attribute passed in.
- *ngIf - ngIf is used to display or hide the DOM Element based on the expression value assigned to it. The expression value may be either true or false.
- *ngIf-else - ngIf-else works like a simple If-else statement, wherein if the condition is true then ‘If’ DOM element is rendered, else the other DOM Element is rendered. Angular uses ng-template with element selector in order to display the else section on DOM.
- *ngFor - *ngFor is used to loop through the dynamic lists in the DOM. Simply, it is used to build data presentation lists and tables in HTML DOM.
- *ngSwitch - ngSwitch is used to choose between multiple case statements defined by the expressions inside the *ngSwitchCase and display on the DOM Element according to that. If no expression is matched, the default case DOM Element is displayed.
- Use case - Sometimes , there occurs a need where in we need to use two structural directives simultaneously. We need to hide and show a grid and within the grid we want to iterate over the list.
- Alert Point!!!!!.....We can’t use two structural directives in the same DOM element.
- Solution :Not so elegant solution – Use two different HTML tag , one with ngIf and other with ngFor. Unnecessary Dom addition , which can affect the layout.
- Elegant Solution – use ng-container
- It allows us to create a division or section in a template without introducing a new HTML element.
- It is not render in the DOM, but content inside it is rendered.
- It is just a syntax element , which is rendered as a comment.
- A pipe is a way to write display-value transformations that you can declare in your HTML. It takes in data as input and transforms it to a desired output.
- Please note – Pipe only change the display value and not the real time values , they remain as it is.
- Use Case : Alter Date format in display or make a text uppercase
- Angular provides number of default pipes which suffices many of the requirements.
- Exhaustive list is present at https://angular.io/api/common#pipes.
- To apply a pipe, use the pipe operator (|) within a template expression as shown in the following code example, along with the name of the pipe. Also ,we can pass multiple parameters by using colon.
- Few Examples :
Angular Router ? Components, routes and paths ? Steps to setup basic Routing demo
- Intro to Angular Router
- The Components, routes and paths
- The router outlet
- The routerLink directive (replaces the href attribute)
- Steps to setup basic Routing demo
- Route parameters
- Query parameters
- Route guards
- Feature Module
- Lazy Loading
- Route resolvers
- The Angular router is an essential element of the Angular platform.
- It allows developers to build Single Page Applications with multiple states and views using routes and components and allows client side navigation and routing between the various components.
- Components
Metadata
- Cycle Hooks
ngOnInit
ngDoCheck
ngAfterContentInit
ngAfterContentChecked
ngAfterViewInit
ngAfterViewChecked
- ngOnDestroy
- Components are the most basic UI building block of an Angular app.
- An Angular app contains a tree of Angular components.
- Angular components are a subset of directives, always associated with a template. Unlike other directives, only one component can be instantiated for a given element in a template.
- A component must belong to an NgModule in order for it to be available to another component or application. To make it a member of an NgModule, list it in the declarations field of the NgModule metadata.
Option |
Description |
The change-detection strategy to use for this component. |
|
Defines the set of injectable objects that are visible to its view DOM children. See example. |
|
The module ID of the module that contains the component. The component must be able to resolve relative URLs for templates and styles. SystemJS exposes the __moduleName variable within each module. In CommonJS, this can be set to module.id. |
|
The relative path or absolute URL of a template file for an Angular component. If provided, do not supply an inline template using template. |
|
An inline template for an Angular component. If provided, do not supply a template file using templateUrl. |
|
One or more relative paths or absolute URLs for files containing CSS stylesheets to use in this component. |
|
One or more inline CSS stylesheets to use in this component. |
|
One or more animation trigger() calls, containing state() and transition() definitions. See the Animations guide and animations API documentation. |
|
An encapsulation policy for the template and CSS styles. One of: |
|
Overrides the default interpolation start and end delimiters ({{ and }}). |
|
A set of components that should be compiled along with this component. For each component listed here, Angular creates a ComponentFactory and stores it in the ComponentFactoryResolver. |
|
True to preserve or false to remove potentially superfluous whitespace characters from the compiled template. Whitespace characters are those matching the \s character class in JavaScript regular expressions. Default is false, unless overridden in compiler options. |
What is Angular CLI ? Angular CLI Commands ? Basic Project structure ? What is Mono Repo Pattern?
- The Angular CLI is a command-line interface tool that you use to initialize, develop, scaffold, and maintain Angular applications directly from a command shell
- npm install -g @angular/cli
- Online help is available on the command line
- ng help
- ng generate –help
- To create, build, and serve a new, basic Angular project on a development server
- ng new my-first-project
- cd my-first-project
- ng serve
COMMAND |
ALIAS |
DESCRIPTION |
|
Adds support for an external library to your project. |
|
|
Configures the gathering of Angular CLI usage metrics |
|
b |
Compiles an Angular app into an output directory named dist/ at the given output path. Must be executed from within a workspace directory. |
|
|
Retrieves or sets Angular configuration values in the angular.json file for the workspace. |
|
|
Invokes the deploy builder for a specified project or for the default project in the workspace. |
|
d |
Opens the official Angular documentation (angular.io) in a browser, and searches for a given keyword. |
|
e |
Builds and serves an Angular app, then runs end-to-end tests using Protractor. |
|
i18n-extract xi18n |
Extracts i18n messages from source code. |
|
g |
Generates and/or modifies files based on a schematic. |
|
|
Lists available commands and their short descriptions. |
|
l |
Runs linting tools on Angular app code in a given project folder. |
|
n |
Creates a new workspace and an initial Angular application. |
|
|
Runs an Architect target with an optional custom builder configuration defined in your project. |
|
s |
Builds and serves your app, rebuilding on file changes. |
|
t |
Runs unit tests in a project. |
|
|
Updates your application and its dependencies. See https://update.angular.io/ |
|
v |
Outputs Angular CLI version. |
WORKSPACE CONFIG FILES |
PURPOSE |
angular.json |
CLI configuration defaults for all projects in the workspace, including configuration options for build, serve, and test tools that the CLI uses, such as TSLint, Karma, and Protractor. For details, see Angular Workspace Configuration. |
package.json |
Configures npm package dependencies that are available to all projects in the workspace. See npm documentation for the specific format and contents of this file. |
package-lock.json |
Provides version information for all packages installed into node_modules by the npm client. See npm documentation for details. If you use the yarn client, this file will be yarn.lock instead. |
src/ |
Source files for the root-level application project. |
node_modules/ |
Provides npm packages to the entire workspace. Workspace-wide node_modules dependencies are visible to all projects. |
tsconfig.json |
The base TypeScript configuration for projects in the workspace. All other configuration files inherit from this base file. For more information, see the Configuration inheritance with extends section of the TypeScript documentation. |
tslint.json |
Default TSLint configuration for projects in the workspace. |
- The Monorepo, as the name suggests mono (single) and repo (repository of the codebase) is a single source of truth for the entire organization code base.