Allow NgComponentOutlet to dynamically load a module, then load a component from
that module. Useful for lazy loading code, then add the lazy loaded code to the
page using NgComponentOutlet.
Closes#14043
There are restrictions on the character set that can be used for xmb and xtb
placeholder names.
However because changing the placeholder names would change the message IDs it
is not possible to add those restrictions to the names used internally. Then we
have to map internal name to public names when generating an xmb file and back
when translating using an xtb file.
Note for implementors of `Serializer`:
- When writing a file, the implementor should take care of converting the
internal names to public names while visiting the message nodes - this is
required because the original nodes are needed to compute the message ID.
- When reading a file, the implementor does not need to take care of the mapping
back to internal names as this is handled in the `I18nToHtmlVisitor` used by the
`TranslationBundle`.
fixes b/34339636
This patch adds the gulp command of `validate-commit-messages`
which will validate the range of commits messages present in the
active branch.
This check now runs on CI as part of the linting checks.
Allowed commit message types and scopes are controlled via commit-message.json file
and documented at https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines
This solution is based on old Vojta's code that he wrote for angular/angular.js, that was later adjusted
by @matsko in #13815.
Ideally we should switch over to something like https://www.npmjs.com/package/commitplease
as suggested in #9953 but that package currently doesn't support strict scope checking,
which is one of the primarily goal of this PR.
Note that this PR removes support for "chore" which was previously overused
by everyone on the team.
Closes#13815Fixes#3337
The new view engine allows our codegen to produce less code,
as it can interpret view definitions during runtime.
The view engine is not feature complete yet, but already
allows to implement a tree benchmark based on it.
Part of #14013
- Introduce `InjectionToken<T>` which is a parameterized and type-safe
version of `OpaqueToken`.
DEPRECATION:
- `OpaqueToken` is now deprecated, use `InjectionToken<T>` instead.
- `Injector.get(token: any, notFoundValue?: any): any` is now deprecated
use the same method which is now overloaded as
`Injector.get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T): T;`.
Migration
- Replace `OpaqueToken` with `InjectionToken<?>` and parameterize it.
- Migrate your code to only use `Type<?>` or `InjectionToken<?>` as
injection tokens. Using other tokens will not be supported in the
future.
BREAKING CHANGE:
- Because `injector.get()` is now parameterize it is possible that code
which used to work no longer type checks. Example would be if one
injects `Foo` but configures it as `{provide: Foo, useClass: MockFoo}`.
The injection instance will be that of `MockFoo` but the type will be
`Foo` instead of `any` as in the past. This means that it was possible
to call a method on `MockFoo` in the past which now will fail type
check. See this example:
```
class Foo {}
class MockFoo extends Foo {
setupMock();
}
var PROVIDERS = [
{provide: Foo, useClass: MockFoo}
];
...
function myTest(injector: Injector) {
var foo = injector.get(Foo);
// This line used to work since `foo` used to be `any` before this
// change, it will now be `Foo`, and `Foo` does not have `setUpMock()`.
// The fix is to downcast: `injector.get(Foo) as MockFoo`.
foo.setUpMock();
}
```
PR Close#13785
This commit effectively reverts 7e0f02f96e
as it was an invalid fix for #6385, that created a more significant
bug, which was that changes were not always being detected.
Angular 1 digests should be run inside the ngZone to ensure
that async changes are detected.
We don't know how to fix#6385 without breaking change detection
at this stage. That issue is triggered by async operations, such as
`setTimeout`, being triggered inside scope watcher functions.
One could argue that watcher functions should be pure and not do
work such as triggering async operations. It is possible that the
original use case could be supported by moving the debounce
logic into the watch listener function, which is only called if the
watched value actually changes.
Closes#10660, #12318, #12034
PR Close#13812