René's URL Explorer Experiment


Title: Using Standalone Components · Issue #142 · NativeScript/angular · GitHub

Open Graph Title: Using Standalone Components · Issue #142 · NativeScript/angular

X Title: Using Standalone Components · Issue #142 · NativeScript/angular

Description: Is your feature request related to a problem? Please describe. According to the Issues list, it should theoretically be possible to create a NativeScript Angular application that contains standalone components; however, I have yet to fig...

Open Graph Description: Is your feature request related to a problem? Please describe. According to the Issues list, it should theoretically be possible to create a NativeScript Angular application that contains standalon...

X Description: Is your feature request related to a problem? Please describe. According to the Issues list, it should theoretically be possible to create a NativeScript Angular application that contains standalon...

Opengraph URL: https://github.com/NativeScript/angular/issues/142

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Using Standalone Components","articleBody":"**Is your feature request related to a problem? Please describe.**\r\n\u003c!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]. --\u003e \r\n\r\nAccording to the Issues list, it should theoretically be possible to create a NativeScript Angular application that contains standalone components; however, I have yet to figure out how to do that without crashing the application. \r\n\r\nIf you look at the application that is generated using `ng new` today, everything is standalone, from the `main.ts` down. It seems that currently `@nativescript/angular` only supports bootstrapping a module, as opposed to an application/component. If I want my main app component to be a standalone component, I can import it into the `AppModule`:\r\n\r\n```ts\r\n@NgModule({\r\n  imports: [NativeScriptModule, AppRoutingModule, AppComponent],\r\n  bootstrap: [AppComponent],\r\n```\r\n\r\nbut then it creates the compile error `AppComponent class is a standalone component, which can not be used in the @NgModule.bootstrap array. Use the bootstrapApplication function for bootstrap instead.`\r\n\r\nWhen I remove the `bootstrap` option:\r\n\r\n```\r\nThe module AppModule was bootstrapped, but it does not declare '@NgModule.bootstrap' components nor a \"ngDoBootstrap\" method. Please define one of these.\r\n```\r\nThis happens even if I provide an `ngDoBootstrap()` function:\r\n\r\n```ts\r\nexport class AppModule {\r\n  ngDoBootstrap() {\r\n    console.log('ngDoBootstrap');\r\n  }\r\n}\r\n```\r\nOK, so Angular wants an App Module when bootstrapped to have a non-standalone component to bootstrap. Let's try that:\r\n```ts\r\n@Component({\r\n  selector: 'ns-root',\r\n  template: `\u003cGridLayout\u003e\u003cLabel text=\"hello\"\u003e\u003c/Label\u003e\u003c/GridLayout\u003e`,\r\n})\r\nexport class RootComponent {}\r\n\r\n@NgModule({\r\n  imports: [NativeScriptModule, AppRoutingModule],\r\n  declarations: [RootComponent],\r\n  bootstrap: [RootComponent],\r\n  schemas: [NO_ERRORS_SCHEMA],\r\n})\r\nexport class AppModule {}\r\n```\r\nThis works, but as soon as you try to drop in your standalone component:\r\n```ts\r\n@Component({\r\n  selector: 'ns-root',\r\n  template: `\u003cns-app\u003e\u003c/ns-app\u003e`,\r\n})\r\nexport class RootComponent {}\r\n\r\n@NgModule({\r\n  imports: [NativeScriptModule, AppRoutingModule, AppComponent],\r\n  declarations: [RootComponent],\r\n  bootstrap: [RootComponent],\r\n  schemas: [NO_ERRORS_SCHEMA],\r\n})\r\nexport class AppModule {}\r\n```\r\n\r\nYou get a nasty error (at least on my Android Emulator):\r\n\r\n```\r\nSystem.err: An uncaught Exception occurred on \"main\" thread.\r\n  System.err: Unable to start activity ComponentInfo{org.nativescript.tracker/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed\r\n  System.err: Error: java.lang.IllegalArgumentException: Cannot add a null child view to a ViewGroup\r\n  System.err:\r\n  System.err: StackTrace:\r\n  System.err: setActivityContent(file: src/webpack:/tracker/node_modules/@nativescript/core/ui/frame/callbacks/activity-callbacks.js:234:0)\r\n  System.err:   at onCreate(file: src/webpack:/tracker/node_modules/@nativescript/core/ui/frame/callbacks/activity-callbacks.js:46:0)\r\n  System.err:   at onCreate(file: src/webpack:/tracker/node_modules/@nativescript/core/ui/frame/activity.android.js:24:0)\r\n  System.err:   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4048)\r\n  System.err:   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4235)\r\n  System.err:   at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:112)\r\n  System.err:   at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:174)\r\n  System.err:   at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:109)\r\n  System.err:   at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:81)\r\n  System.err:   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2636)\r\n  System.err:   at android.os.Handler.dispatchMessage(Handler.java:107)\r\n  System.err:   at android.os.Looper.loopOnce(Looper.java:232)\r\n  System.err:   at android.os.Looper.loop(Looper.java:317)\r\n  System.err:   at android.app.ActivityThread.main(ActivityThread.java:8705)\r\n  System.err:   at java.lang.reflect.Method.invoke(Native Method)\r\n  System.err:   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)\r\n  System.err:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)\r\n  System.err: Caused by: com.tns.NativeScriptException: Calling js method onCreate failed\r\n  System.err: Error: java.lang.IllegalArgumentException: Cannot add a null child view to a ViewGroup\r\n  System.err:   at com.tns.Runtime.callJSMethodNative(Native Method)\r\n  System.err:   at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1302)\r\n  System.err:   at com.tns.Runtime.callJSMethodImpl(Runtime.java:1188)\r\n  System.err:   at com.tns.Runtime.callJSMethod(Runtime.java:1175)\r\n  System.err:   at com.tns.Runtime.callJSMethod(Runtime.java:1153)\r\n  System.err:   at com.tns.Runtime.callJSMethod(Runtime.java:1149)\r\n  System.err:   at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:57)\r\n  System.err:   at android.app.Activity.performCreate(Activity.java:9002)\r\n  System.err:   at android.app.Activity.performCreate(Activity.java:8980)\r\n  System.err:   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1526)\r\n  System.err:   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4030)\r\n  System.err:   ... 13 more\r\n  System.err: Caused by: java.lang.IllegalArgumentException: Cannot add a null child view to a ViewGroup\r\n  System.err:   at android.view.ViewGroup.addView(ViewGroup.java:5077)\r\n  System.err:   at android.view.ViewGroup.addView(ViewGroup.java:5057)\r\n  System.err:   at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:719)\r\n  System.err:   at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:207)\r\n  System.err:   ... 24 more\r\n```\r\n\r\n**Describe the solution you'd like**\r\n\r\nA clear and concise example of how to develop a NativeScript Angular app, using standalone components.","author":{"url":"https://github.com/joeskeen","@type":"Person","name":"joeskeen"},"datePublished":"2024-10-30T18:27:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/142/angular/issues/142"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:91ca3795-3dca-408c-7016-4f3b257b21f1
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA908:1D1F0B:51AC1:746E4:6A636C10
html-safe-nonce1366f50e698467df5b494bbe95fa14b998659ee9ecf02e30090743eb4b904b38
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTA4OjFEMUYwQjo1MUFDMTo3NDZFNDo2QTYzNkMxMCIsInZpc2l0b3JfaWQiOiI4NDIyODAxNzA1MzA3MTcxODU2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac4b9952d4025641fb5739d11081cacd3bff6a7af15778da4d44f67cb85dd8b1b9
hovercard-subject-tagissue:2624969043
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/angular/142/issue_layout
twitter:imagehttps://opengraph.githubassets.com/de354f7bc3bb049681cd15f8fb657a244f135b751d0096041ad275ba3824246a/NativeScript/angular/issues/142
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/de354f7bc3bb049681cd15f8fb657a244f135b751d0096041ad275ba3824246a/NativeScript/angular/issues/142
og:image:altIs your feature request related to a problem? Please describe. According to the Issues list, it should theoretically be possible to create a NativeScript Angular application that contains standalon...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejoeskeen
hostnamegithub.com
expected-hostnamegithub.com
Nonee7b5617850fbcd6d10fe2b7c56398444bccb5f3a58a4a18c6d363971295bcd03
turbo-cache-controlno-preview
go-importgithub.com/NativeScript/angular git https://github.com/NativeScript/angular.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id302428305
octolytics-dimension-repository_nwoNativeScript/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id302428305
octolytics-dimension-repository_network_root_nwoNativeScript/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseaa341b3f432dc63fa9633042725aec601722a352
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/NativeScript/angular/issues/142#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fangular%2Fissues%2F142
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fangular%2Fissues%2F142
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=NativeScript%2Fangular
Reloadhttps://github.com/NativeScript/angular/issues/142
Reloadhttps://github.com/NativeScript/angular/issues/142
Reloadhttps://github.com/NativeScript/angular/issues/142
Please reload this pagehttps://github.com/NativeScript/angular/issues/142
NativeScript https://github.com/NativeScript
angularhttps://github.com/NativeScript/angular
Please reload this pagehttps://github.com/NativeScript/angular/issues/142
Notifications https://github.com/login?return_to=%2FNativeScript%2Fangular
Fork 13 https://github.com/login?return_to=%2FNativeScript%2Fangular
Star 55 https://github.com/login?return_to=%2FNativeScript%2Fangular
Code https://github.com/NativeScript/angular
Issues 39 https://github.com/NativeScript/angular/issues
Pull requests 4 https://github.com/NativeScript/angular/pulls
Actions https://github.com/NativeScript/angular/actions
Projects https://github.com/NativeScript/angular/projects
Security and quality 0 https://github.com/NativeScript/angular/security
Insights https://github.com/NativeScript/angular/pulse
Code https://github.com/NativeScript/angular
Issues https://github.com/NativeScript/angular/issues
Pull requests https://github.com/NativeScript/angular/pulls
Actions https://github.com/NativeScript/angular/actions
Projects https://github.com/NativeScript/angular/projects
Security and quality https://github.com/NativeScript/angular/security
Insights https://github.com/NativeScript/angular/pulse
Using Standalone Componentshttps://github.com/NativeScript/angular/issues/142#top
https://github.com/joeskeen
joeskeenhttps://github.com/joeskeen
on Oct 30, 2024https://github.com/NativeScript/angular/issues/142#issue-2624969043
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.