- Dec 2023
-
angular.cn angular.cn
-
配置依赖提供者
DI提供者是什么,如何使用
Tags
Annotators
URL
-
- May 2023
-
-
The illustration is okay as a refresher, but the critique in the first comment may be more useful.
-
- Dec 2022
-
-
Dorustree provides angular js development services and specialises in creating web applications for simple to complex business solutions. We are a custom angular js development firm.
-
-
www.zhihu.com www.zhihu.com
-
AngularJS按需动态加载template和controller?
Tags
Annotators
URL
-
- Mar 2022
-
aglowiditsolutions.com aglowiditsolutions.com
-
Hire AngularJS Developers | Dedicated Angular Programmers
-
- Nov 2021
-
blog.worldmaker.net blog.worldmaker.net
Tags
Annotators
URL
-
- Jun 2021
-
www.interviewbit.com www.interviewbit.com
-
Angular is nothing but an open-source web application framework. It is being led by the Angular Team at Google and also by a community of individuals and corporations. It is based on TypeScript.Angular is a complete rewrite from the same team that had built AngularJS. It can be used as the frontend of the MEAN stack, which consists of the MongoDB database, Express.js web application server framework, Angular itself (or AngularJS), and the Node.js server runtime environment.
Top Angular 8 Interview Questions to get you ready
-
- Feb 2021
-
www.honeybadger.io www.honeybadger.io
-
we plan to migrate to Angular 1, and we'll finish out the decade on React
Wrong direction: I'd recommend migrate from Angular to React.
-
- Nov 2020
-
imfeld.dev imfeld.dev
-
But you can still run into strange race conditions where the browser displays stale data depending on if some other unrelated code has caused a digest update to run after the buggy code or not.
-
Converting Angular components into Svelte is largely a mechanical process. For the most part, each Angular template feature has a direct corollary in Svelte. Some things are simpler and some are more complex but overall it's pretty easy to do.
-
We don't use "attribute directives" much which makes things easier.
-
Directives like ng-if="info.report.revenue" sort of work in Angular if info.report is undefined, in that the ng-if becomes false. But the Svelte equivalent {#if info.report.revenue} throws an error. For now we're using lodash get in places where we need to and looking forward to Svelte support for optional chaining.
-
Embedding Svelte inside Angular is pretty easy, for the most part. I wrote a function that would take in a Svelte component and generate an Angular controller class.
-
It's really helpful that Svelte stores are easy to use in plain JS. We can change a state store over completely to Svelte and make the Angular components subscribe to that store as well without needing to maintain and sync 2 copies of the state.
Tags
- mechanical process
- simplicity of design
- Angular
- missing feature
- javascript
- Svelte: store
- race condition
- equivalent/analogous/alternative ways to do something between 2 libraries/languages/etc.
- Svelte
- it's just _
- optional chaining/safe navigation operator
- change detection
- simplifying
- interoperability
- strange problems
- wrapper
Annotators
URL
-
-
medium.com medium.com
-
The advantage of ngOnChanges() is that we get all the changes at once if the component has several @Input()s. However, if we have a single @Input() a setter is probably the better approach.
-
-
gist.github.com gist.github.com
-
-
A View is a fundamental building block of the application UI. It is the smallest grouping of Elements which are created and destroyed together.
-
an Angular application is a tree of components
-
-
stackoverflow.com stackoverflow.com
-
Content is what is passed as children usually to be projected at some <ng-content> element of a component. View is the template of the current component. The view is initialized after the content and ngAfterViewInit() is therefore called after ngAfterContentInit().
-
-
-
In Angular CLI 6 this command has been removed, and it will not come back. Instead there is a new concept called Builders.With the new Angular CLI you can customize the build process by defining your own builders as well as using one of the builders provided by the community.
Why did they remove it if it was useful? They wanted people to be stuck in Angular CLI world? Couldn't they still provide that escape route / migration path for those that really do need/want to eject?
-
In Angular CLI 1.x (Angular 5) you had ng eject command for this, which was ejecting the whole underlying webpack configuration and allowing you to modify it as you please.
-
- Oct 2020
-
stackoverflow.com stackoverflow.com
-
this.txtQueryChanged .debounceTime(1000) // wait 1 sec after the last event before emitting last event .distinctUntilChanged() // only emit if value is different from previous value .subscribe(model => { this.txtQuery = model;
-
-
stackoverflow.com stackoverflow.com
-
With Angular 2 we can debounce using RxJS operator debounceTime() on a form control's valueChanges observable:
What's the React/Svelte equiv. pattern for this?
-
- Sep 2020
-
github.com github.com
-
I think Svelte's approach where it replaces component instances with the component markup is vastly superior to Angular and the other frameworks. It gives the developer more control over what the DOM structure looks like at runtime—which means better performance and fewer CSS headaches, and also allows the developer to create very powerful recursive components.
-
-
stackoverflow.com stackoverflow.com
-
being able to compose multiple components' functionality via decoration (not creating new "combo" components or something) is more elegant, and something I wish React had.
-
The whole point of directives is composability. First: you can apply a directive to any component, even components included from other libraries. Second: you can apply multiple directives to the same component. Directives are decorators, so it's not the same thing.
-
- Aug 2020
-
angular.io angular.io
-
The let keyword declares a template input variable that you reference within the template. The input variables in this example are hero, i, and odd. The parser translates let hero, let i, and let odd into variables named let-hero, let-i, and let-odd.
Tags
Annotators
URL
-
- Apr 2020
-
-
SPAs are incredibly common, popularised by client-side web frameworks like Angular, React and Vue.js.
SPAs:
- popularised by client-side web frameworks like Angular, React and Vue.js
- real difference between the MVP app is shifting most of its work on the client side
- there's client side MVC, MVVM (model-view-view-model) and FRP (functional reactive programming)
Angular - client side MVC framework following its pattern, except it's running inside the users web browser.
React - implementation of FRP. A little more flexible, but more concerned with state change events in data (often using some event store like Redux)
-
-
angular-course.releasenotes.io angular-course.releasenotes.io
-
online Angular Training which has been designed by the industry experts which will help you to create web applications and deploy Angular CLI
Check this for Angular Course from Intellipaat.
Tags
Annotators
URL
-
- Nov 2019
-
www.primefaces.org www.primefaces.orgPrimeNG1
Tags
Annotators
URL
-
- Oct 2019
-
github.com github.com
-
I'm super stoked about Vue.js though...I'm kind of over Angular at this point since it left a bad taste in my mouth last year (it's a much larger framework and the 'official' build system isn't even being used anymore by programmers)
-
I'm doing a newer project in Vue.js because it looks much lighter than Angular and just awesome all around
-
Been there, done that. Vue.js takes the best ideas form Angular (and some from React), without putting you in ZoneAwareError hell.
-
- Sep 2019
-
stackoverflow.com stackoverflow.com
-
stackblitz.com stackblitz.com
-
angular.io angular.io
Tags
Annotators
URL
-
-
blog.angular-university.io blog.angular-university.io
-
stackoverflow.com stackoverflow.com
-
github.com github.com
-
@angular-react/core
-
- May 2019
-
blog.angular-university.io blog.angular-university.io
-
But like its usual in the case of Observable-based APIs, FRP techniques can help easily implement many use cases that would otherwise be rather hard to implement such as: pre-save the form in the background at each valid state, or even invalid (for example storing the invalid value in a cookie for later use) typical desktop features like undo/redo
key point on why FRP is good: misc usages on each 'state' change in the form - record and save state for 'undo' feature, save to local storage to be recovered later, etc
-
This is why this is called template-driven forms, because both validation and binding are all setup in a declarative way at the level of the template.
key point on naming of 'template-driven forms'
-
You are probably wondering what we gained here. On the surface there is already a big gain: We can now unit test the form validation logic
key point - advantage of reactive forms is the testability of its validation
-
- Dec 2018
-
angular.io angular.io
-
Then inject it inside a test by calling TestBed.get() with the service class as the argument. it('should use ValueService', () => { service = TestBed.get(ValueService); expect(service.getValue()).toBe('real value'); });
this is for testing the service, directly
-
However, you almost always inject service into application classes using Angular dependency injection and you should have tests that reflect that usage pattern. Angular testing utilities make it easy to investigate how injected services behave.
key point
-
-
-
We can even remove the AuthService import if we want, there really is no dependency on anything else. The LoginComponent is tested in isolation:
that's a key point - isolating stuff. remember this is unit testing, not integration tests. we wish to have as little as dependencies as possible.
-
That’s not very isolated but also not too much to ask for in this scenario. However imagine if LoginComponent required a number of other dependencies in order to run, we would need to know the inner workings of a number of other classes just to test our LoginComponent. This results in Tight Coupling and our tests being very Brittle, i.e. likely to break easily. For example if the AuthService changed how it stored the token, from localStorage to cookies then the LoginComponent test would break since it would still be setting the token via localStorage.
key points - this shows the benefits (easy) of this kind of testing and its disadvantages (coupled, easy to break if a service changes its implementation)
-
- Nov 2018
-
www.xfive.co www.xfive.co
-
Mocking localStorage is optional, but without mocking getComputedStyle your test won’t run, as Angular checks in which browser it executes. We need to fake it.
key point
Tags
Annotators
URL
-
-
angular.io angular.io
-
Or inside the beforeEach() if you prefer to inject the service as part of your setup. beforeEach(() => { TestBed.configureTestingModule({ providers: [ValueService] }); service = TestBed.get(ValueService); });
this corresponds with the option mentioned above - inject it inside a single test
-
- Oct 2018
-
levelup.gitconnected.com levelup.gitconnected.com
- Sep 2018
-
blog.angularindepth.com blog.angularindepth.com
-
This is known as the entry file.
Key point
-
When we use ng new the Angular CLI creates a new workspace for us.In our Angular workspace we are going to have two projects:A library projectThis is the library of components and services that we want to provide. This is the code that we could publish to npm for example.An application projectThis will be a test harness for our library. Sometimes this application is used as documentation and example usage of the library.
Good ideas about what to do with the needed 'application' that we are forced to create just to create the library.
-
-
-
When we’ve generated the library (ng generate library tvmaze ) Angular CLI modified the tsconfig.json in the root of our project by adding tvmaze to the paths entry.
Read - this is how to fake a local library to be imported by TS as if it was in node_modules
-
Why is that useful? It enables such service to be tree-shaken (removed form the production bundle if not used)
Very important note - useful!
-
- Aug 2018
-
-
Then it gets the native element of the compiled HTML (the HTML rendered by the component).
This explains what 'native element' is, at least in this case. Its the outcome HTML after the detectChanges()
-
We use an async before each. The purpose of the async is to let all the possible asynchronous code to finish before continuing.
Is this like putting your code in setTimeout() just to push it into the event loop task queue?...
-
-
angular.io angular.io
-
The CLI takes care of Jasmine and karma configuration for you.
meaning, creating a new app using ng new will create the needed mentioned (below) config files
Tags
Annotators
URL
-
-
angular.io angular.io
-
The custom id is persistent. The extractor tool does not change it when the translatable text changes. Therefore, you do not need to update the translation. This approach makes maintenance easier
key point! it allows English speaking site without worrying about translations at all, and keeping translation unit keys constant over time even if the English text is changing
-
The Angular extraction tool preserves both the meaning and the description in the translation source file to facilitate contextually-specific translations, but only the combination of meaning and text message are used to generate the specific id of a translation. If you have two similar text messages with different meanings, they are extracted separately. If you have two similar text messages with different descriptions (not different meanings), then they are extracted only once
important - this is how the 'keys' for the translation person are extracted - what determines the singularity of the translation item.
-
You need to build and deploy a separate version of the app for each supported language
key point!
-
The CLI imports the locale data for you when you use the parameter --configuration with ng serve and ng build
See sample i18n app (link in the beginning of this document). Basically, in package.json: "scripts": { "start": "ng serve", "start:fr": "ng serve --configuration=fr", "build": "ng build --prod", "build:fr": "ng build --configuration=production-fr",
-
-
angular.io angular.io
-
To define a class as a service in Angular, use the @Injectable() decorator to provide the metadata that allows Angular to inject it into a component as a dependency. Similarly, use the @Injectable() decorator to indicate that a component or other class (such as another service, a pipe, or an NgModule) has a dependency.
This means that the 'injectable' decorator has two meanings and two usages. I think this wasn't so in the past.
-
- Jul 2017
-
blog.udemy.com blog.udemy.com
-
retire our default home page that is built with a Jade view, and instead use an Angular view
use Angular view instead of Jade view
Tags
Annotators
URL
-
- Mar 2017
- Feb 2017
-
angular.io angular.io
-
how it uses zones
Does anyone have an authoritative link for this concept of zones and how they work? It'd be much appreciated.
-
In general, add providers to the root module so that the same instance of a service is available everywhere.
So, from this I take it that once a Service is added to the root module, it can be used by any component of that module.
What about the components imported, from sub-modules of the root one? Can their dependency needs be met, in similar fashion? For example, could a Component in another module (imported into the root one) just request a Service provided in the root module and have it properly injected from there, without anything else on the developer's part?
-
you get a new instance of the service with each new instance of that component
So, I take it that the Service instance will not be a singleton anymore? Whereas, if provided from the root module, it will?
-
- Jan 2017
-
angular.io angular.io
-
Component classes should be lean. They don't fetch data from the server, validate user input, or log directly to the console. They delegate such tasks to services.
A really good point! Lean-ness is something to strive for.
-
While a component is technically a directive, components are so distinctive and central to Angular applications that this architectural overview separates components from directives.
As per the MVVM pattern, they sort of provide the support for the View. They are like the glue for the visual representation of a part of the application. A controller of sorts (but not quite one) of MVC.
-
other metadata decorators
A somewhat comprehensive list of the currently available class decorators and their roles can be found in the Official Angular Cheat Sheet.
-
- Dec 2016
-
stackoverflow.com stackoverflow.com
-
Change: collapse to uib-collapse.
Ui-Bootstrap - easy to forget this one. Keep an eye out for it!
-
- Aug 2016
-
docs.angularjs.org docs.angularjs.org
-
function(context, locals)
context.locals as seen in a plunkr example
var template =$parse( "libs[i]" ) ; this.libs=["ng" ," jquery", "bootstrap"] ; for(i= 0; i< this.libs.length; i++) {
output = output + '
- ' + **template(this, {i: i}) **+ '
'; this.parsedMsg = 'The project uses- ' + output + '
}
Tags
Annotators
URL
-
- May 2016
-
jtblin.github.io jtblin.github.io
-
bower_components
Ionic installs bower components (bower packages) into the project's lib folder:
www/lib
This behaviour is defined in the projects .bowerrc file, which looks like this:
{ "directory": "www/lib" }
The project .bowerrc file may be found at the same level as the www folder.
Note that if you install angular-chart this way, you don't need to install Chart.js separately; it is one of the dependencies that bower will install for you. Of course, you must include the script tag that references the Chart.js file as usual!
Finally, if you want to link angular-chart.css you must follow the same procedure.
-
- Mar 2016
-
angularjs.blogspot.com angularjs.blogspot.com
-
The basic argument here is that templates have an advantage because they are constrained compared to allowing component structure to be defined in arbitrary JS is valid.
-
- Jan 2016
-
-
Quite a useful article summarizing the state of React and Angular 2 and to be fair, it does make criticisms of both sides.
-
- Aug 2015
-
nathanleclaire.com nathanleclaire.com
-
Use factories if you want to change variables externally. Otherwise angulars digest cycle may miss the change, or crash upon forced digestion.
-
-
victorsavkin.com victorsavkin.com
-
Angular 2 embraces web platform standards, so it puts the view of the component in the Shadow DOM of the element where it has been created. If your browser does not support Shadow Dom, Angular will emulate it on a par with native shadow DOM.
At the time this was written I don't think vendors were anywhere near agreement on several major aspects of shadow DOM
-
- Jun 2015
-
stackoverflow.com stackoverflow.com
-
Creating a DOM-element using a directive
-