Angular feature module : where should I store module related assets?
I am developing a feature module with Angular and I am wondering about where I should place the assets related to the module.
If I understood correctly the idea behind feature modules, it should be in an assets folder in the feature module. This way, I could reuse this module in any app without the concern of looking for related medias in the main assets folder.
However, I was not able to find an answer to this question on Stack Overflow or on the internet.
What is the common practice in Angular?
do you know?
how many words do you know
See also questions close to this topic
-
How to get only one question to the preview page in survey management website in angular?
I am using querystring to h=get the questions on preview page but I am not able to get one question on 1st page and 2nd on another page after clicking next button.
Querystring
const queryString = { SurveyId: 1, PageNo: 0, PageSize: 20 };
-
@Host() or ng-container incompatibility between angular 9 and 10
Here are two live examples on stackblitz:
To check the difference between them, open console and notice that:
In form-error-control-name.directive.ts line 22:
For angular 9, this.parent.control is not null For angular 10, this.parent.control will throw error
What is the difference? I checked angular 10 update doc but don't know which incompatibility this is.
Thanks!
-
How can I delete a row by its SKU instead of its ID?
I try to delete the row using the sku of the product. I'm using spring boot and angular. I got an error when I added the sku on my button like this one
(click)="onDeleteProductBySku(deleteClick?.sku)"
it said that theProperty 'sku' does not exist on type '(product: Product) => void'.
. On my command prompt, I got this error. How can I solve this problem?Error: product/product.component.html:50:109 - error TS2339: Property 'sku' does not exist on type '(product: Product) => void'. 50 <button class="btn btn-outline-danger btn-sm me-2" (click)="onDeleteProductBySku(deleteClick?.sku)">Delete</button> product/product.component.ts:12:16 12 templateUrl: './product.component.html', ~~~~~~~~~~~~~~~~~~~~~~~~~~ Error occurs in the template of component ProductComponent.
ProductsController.java --> This is working on the postman.
//Delete a product record using sku //http://localhost:8080/products/deletebysku?sku=12345678 @DeleteMapping("/products/deletebysku") @ResponseBody private void deleteProductBySku(@RequestParam String sku){ productsService.deleteProductBySku(sku); }
product.component.ts
public deleteProduct!: Product; public onDeleteProductBySku(sku: string): void { this.productServive.deleteProductBySku(sku).subscribe( (response: void) => { this.messageShow(); console.log(response); this.getAllProduct(); }, (error: HttpErrorResponse) => { this.errorMessage(error.message); } ); } public deleteClick(product: Product) { this.deleteProduct = product; console.log("delete by sku"); }
product.service.ts
public deleteProductBySku(sku: string): Observable<void> { return this.http.delete<void>(`${this.apiServerUrl}/products/deletebysku?sku=${sku}`); }
product.component.html
<button class="btn btn-outline-danger btn-sm me-2" (click)="onDeleteProductBySku(deleteClick?.sku)">Delete</button>
-
How can I list the folders within my assets folder?
I have a series of folders within my asset folder. Each folder contains pictures and documents. I'm having trouble getting an activity to list the contents of my asset folder. I've tried a number of solutions that I've found online but can't get anything to work. In this activity I'm trying to just list the folders within the asset folder. From there a user could click on a folder and open it. I think I have a decent understanding of how to open the folder when clicked. I'm just struggling with how to list the folders.
I have tried: Adding this to my onCreate method:
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview); final AssetManager assetManager = getAssets(); try { // for assets folder add empty string String[] filelist = assetManager.list(""); // for assets/subFolderInAssets add only subfolder name if (filelist == null) { // dir does not exist or is not a directory } else { for (int i=0; i<filelist.length; i++) { // Get filename of file or directory String filename = filelist[i]; } } } catch (IOException e) { e.printStackTrace(); } }
Nothing shows up when I do this.
I have tried this:
public static List<String> listAssetFiles(Context c, String rootPath) { List<String> files =new ArrayList<>(); try { String [] Paths = c.getAssets().list(rootPath); if (Paths.length > 0) { // This is a folder for (String file : Paths) { String path = rootPath + "/" + file; if (new File(path).isDirectory()) files.addAll(listAssetFiles(c,path)); else files.add(path); } } } catch (IOException e) { e.printStackTrace(); } return files; }
I've tried a few other things as well. I cannot seem to make this work. Any help would be much appreciated. Thanks in advance.
-
New guidelines for App Icons and Logos missing
Please refer to the article: Current guidelines on App Icons and Logos for Windows
Questions:
How do these guidelines change for Windows 11?
If one were to do an exhaustive test for all possible assets included in the package for Windows 11 and 10, there is no help here. Are those details documented somewhere?
For example, there are small, medium and wide variations for Tile images mentioned for the Start menu. In Windows 11, I see no way to change the display in order to see or test them. Are all these start menu variations still relevant and possible in Windows 11?
-
Angular-App running with github pages /docs cant find assets
Im trying to host my angular app with github pages.
I build a /docs folder with the command
ng build --output-path docs --base-href /portfolio/
Problem:
The /assets folder which contains images and the translation-keys for the ngx/translate can't be found.
The /assets folder is at /portfolio/src/assets as usual and I also added it to the /docs folder.
Thats the path I use to call the pictures:
'../../../../assets/images/flags/en.png'
At localhost its working fine.