Javascript is a functional programming language, and functions can be written in many different ways.
The map() method creates a new array with the results of calling a provided function on every element in the calling array.
The filter() method creates a new array with all elements that pass the test implemented by the provided function.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi nec metus justo. Aliquam erat volutpat.
The Ultimate Framework
The Angular framework has no concept of a Container, it only knows Modules and Components.
Thinking in terms of Container and Components provides us a useful mental model for distributing data in our app.
There are 3 kinds of directives in Angular:
Directive #1
As if it were its own website, every component typically has 3 files.
The controller for a component is simply a JavaScript class Decorated with the Component Decorator provided by Angular
Once created, the component can be used in other components as if it were a native HTML element
Angular gives us 4 ways to easily manipulate data in the template and you will use them heavily when developing in Angular and Ionic
When you what to input data into a component, or you want an attribute to vary based on some outside condition
How a parent component listens to events or Output from a child component.
When an element has a directive that emits a value and receives a value, you can use Two-Way Data Binding
Remember "Banana in a box"
Allows you to bind a string value from a variable in your TypeScript code to your template for dynamic text changes
Changes the appearance or behavior of an element, component, or another directive
Directive #2
When used in a template a custom directive looks just like a regular HTML attribute.
When building the page, Angular will see our custom directive and initialize the corresponding class we've created for it
This is what the class for that directive might look like. It is annotated with Angular's Directive Decorator and given a selector of our choosing
What Angular uses to restructure the DOM, typically by adding, removing, or manipulating elements.
As with other directives, you apply a structural directive to a host element. The directive then does whatever it's supposed to do with that host element and its descendants.
Directive #3
A structural directive is easily recognized because of the asterisk (*) that precedes the directive attribute name
Allows you to easily control which HTML elements are loaded using conditional statements.
Loops through all the elements of a given array and allows all elements nested inside the parent element to be displayed once for each array item.
Structural Directives (ie ngFor and ngIf) can be nested inside of each other to create complex UI logic.
Cross-platform app development with one code base
Pages in Ionic are components that serve as functional pages of the app you are creating. Navigating between page will invoke a native-like transition.
In Ionic 2 and 3, a page needed to be decorated with the @IonicPage Decorator. Now a page is just a component with it's own module, and when the router loads that module the components and services associated with it are loaded
Ionic Components are set of UI components along with directives to easily control them through code
Before Ionic 4, Ionic Components were built using Angular's Component system. They are being remade into Web Components to be more framework agnostic
A handy component provided by Ionic out-of-the-box that provides a the ability to make binary decisions
A commonly used component provided by ionic that acts as a wrapper for the HTML input element, adding styles and functionality tailored for the Ionic framework
A custom Angular Directive developed by Ionic that wraps the native textarea HTML element
Ionic also provides the Attribute Directive
Passing data to and from components
Giving data to a Child "Dumb" Component in Angular involves creating a property with the @Input decorator in the class file.
The property name you create will then be available as a property of the Component's HTML selector. The item
Children Components can allow access to particular data using the @Output decorator.
The Output data is then available as an event that can be bound to with a function using Angular's event binding.