These are Breakpoints constant actual values.
Monday, 27 December 2021
List of Breakpoints in Angular Material
https://material.angular.io/cdk/layout/api
Etykiety:
Angular,
in English
Thursday, 23 December 2021
Thursday, 9 December 2021
Problem przy tworzeniu Azure Active Directory B2C
Potrzebuję katalogu Azure B2C dla mojego projektu.
Przy próbie utworzenia nowego katalogu dostaję taki błąd:
The subscription is not registered to use namespace 'Microsoft.AzureActiveDirectory'.
See https://aka.ms/rps-not-found for how to register subscriptions.
Rozwiązanie:
- Zaloguj się do Azure
-
Otwórz konsolę
- Konsola może wymagać stworzenia katalogów.
- W konsoli wpisz:
az provider register --namespace Microsoft.AzureActiveDirectory
Po kilku minutach powinno zadziałać. Możesz spróbować stworzyć katalog jeszcze raz.
Tuesday, 20 October 2020
Implementing ControlValueAccessor
import { Component, forwardRef, Input, OnInit } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
@Component({
selector: 'app-password-input',
templateUrl: './password-input.component.html',
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => PasswordInputComponent),
multi: true
}
]
})
export class PasswordInputComponent implements OnInit, ControlValueAccessor {
constructor() {}
writeValue(obj: any): void {
this.Value = obj;
}
registerOnChange(fn: any): void {
this.onChange = fn;
}
registerOnTouched(fn: any): void {
this.onTouch = fn;
}
setDisabledState?(isDisabled: boolean): void {
this.disabled = isDisabled;
}
onChange: any = () => {};
onTouch: any = () => {};
disabled?: boolean;
ngOnInit(): void {}
/** Password value */
public value: string;
set Value(val) {
// this value is updated by programmatic changes
if (val !== undefined && this.value !== val) {
this.value = val;
this.onChange(val);
this.onTouch(val);
}
}
get Value(): string {
return this.value;
}
}
Etykiety:
Angular,
code,
in English,
in Polish,
TypeScript
Thursday, 1 October 2020
Custom Events with Angular Elements
Created component in Angular, it has Output called selectedStep, that emits a number.
@Output() public selectedStep: EventEmitter<number> = new EventEmitter<number>();
How to write CustomEvent in plain HTML + JS page, so that it would eg. display step number to console?
<script>
// trigger this function, when event is emitted from inside custom-element
function stepChanged(e) {
console.log('Current step: ' + e);
}
document.addEventListener("DOMContentLoaded", function() {
// Handler when the DOM is fully loaded
let element = document.querySelector("custom-element");
element.addEventListener("selectedStep", event => {
stepChanged(event.detail);
});
});
</script>
<custom-element></custom-element>
Important to remember: addEventListener
first parameter is the name of Output- Emitted value is in
detail
property of second paramenter
Etykiety:
Angular,
code,
in English,
TypeScript
Wednesday, 23 September 2020
TypeScript - generate random word
This method will generate random string of n-letter length with lowercase letters:
/**
* Generate random lowercase word
* @param {number} length Word length
* @returns Random n-letter word
*/
randomWord(length: number): string {
let result = '';
for (let index = 0; index < length; index++) {
// one of 26 en letters, 'a' = 97
const ascii = Math.floor(Math.random() * 26 + 97);
result += String.fromCharCode(ascii);
}
return result;
}
Etykiety:
code,
in English,
JavaScript,
TypeScript
Tuesday, 1 September 2020
Hide Addons panel for some stories in Storybook
I'm using Code Preview globally in Storybook with
To hide the panel for single story, set following parameters in Story:
storybook-addon-preview
. However, I there is one story that has no code preview and it displays "No Preview found" message.
To hide the panel for single story, set following parameters in Story:
export default { title: 'Some title', parameters: { options: { showPanel: false } } };
Etykiety:
code,
in English,
Storybook
Friday, 17 July 2020
Bootstrap in Storybook
To use Bootstrap modules in Storybook, you have to import NgbModule inside the story and then in the story say:
export default { title: 'Tooltip', decorators: [ moduleMetadata({ // imports both components to allow component composition with storybook declarations: [TooltipComponent], imports: [NgbModule] }), ], };
Etykiety:
code,
in English,
Storybook
Friday, 29 May 2020
Sideload install custom ROM
I have TWRP on my
I decided to install new custom ROM and try Carbon. I pushed the zip file to device, then rebooted to TWRP
and decided to completely wipe the phone. I had a lot of files "orphaned" from some old apps and wanted to get rid of all of them.
Then I realized, that the zip image was also deleted. And in bootloader, adb push does not work. So, what did I do?
1. In TWRP I went to: Advanced > ADB Sideload > Swipe to Start Sideload
Now, if I type
I get my device in sideload mode.
2. Typed:
and the ROM was installed. Then I installed GApps the same way.
bacon
(OnePlus One).I decided to install new custom ROM and try Carbon. I pushed the zip file to device, then rebooted to TWRP
adb reboot recovery
and decided to completely wipe the phone. I had a lot of files "orphaned" from some old apps and wanted to get rid of all of them.
Then I realized, that the zip image was also deleted. And in bootloader, adb push does not work. So, what did I do?
1. In TWRP I went to: Advanced > ADB Sideload > Swipe to Start Sideload
Now, if I type
adb devices
I get my device in sideload mode.
2. Typed:
adb sideload .\CARBON-CR-7.0-OPAL-RELEASE-bacon-20200526-1945.zip
and the ROM was installed. Then I installed GApps the same way.
Etykiety:
Android,
in English
Friday, 15 May 2020
(Re)Install TWRP
Example using OnePlus One (codename: bacon).
- Download platform tools: https://dl.google.com/android/repository/platform-tools_r29.0.5-windows.zip.
- unzip
- Download TWRP: https://dl.twrp.me/bacon/
- Reboot device to fastboot (Vol-Up + Power)
- Open CMD as Admin, go to platform-tools
- fastboot flash recovery twrp-3.3.1-0-bacon.img
- fastboot boot twrp-3.3.1-0-bacon.img
Device will open TWRP.
Etykiety:
Android,
in English
Subscribe to:
Posts (Atom)