You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b0b11cb
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: apps/docs/src/content/getting-started/cli.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,11 +126,32 @@ When the server listens on your network (`--host 0.0.0.0` or a network address),
126
126
|`--allowed-origin <origin>`| An extra origin allowed to reach the server, such as `http://192.168.1.20:8100`. Repeat it for more. |
127
127
|`--proxy-origin <origin>`| The origin of your app's dev server when it proxies `/__pangular/` to this server, such as `http://localhost:4200`. The panel URL on that origin and the one-time code link point there, and the server accepts requests from that origin. See [Client-only Angular CLI app](./installation.md#client-only-angular-cli-app). |
128
128
|`--auth-token <token>`| A [pairing token](../security.md#pairing-tokens) a client may send instead of the one-time code. Repeat it for more. Prefer the `PANGULAR_AUTH_TOKEN` environment variable. |
129
+
|`--lan-address [address]`| Print the server's URL on your network and the define that injects it into a development build of a phone app. Off by default. Without a value it picks this machine's first private IPv4 address. Needs `--host` on the network. See [Inject the LAN address](#inject-the-lan-address). |
129
130
130
131
<ngmd-callouttype="warning"title="Keep it on localhost">
131
132
The server binds to <code>localhost</code> by default and asks for a one-time code. Changing <code>--host</code> or passing <code>--no-auth</code> widens who can reach it. See <ahref="../security.md">Access and redaction</a>.
132
133
</ngmd-callout>
133
134
135
+
### Inject the LAN address
136
+
137
+
A phone app (Capacitor, NativeScript) needs the server's address on your network. The CLI doesn't build your app, so `--lan-address` prints the URL and the define to pass to your app's build. Start the server on the network with it:
138
+
139
+
```bash
140
+
npx pangular dev --host 0.0.0.0 --lan-address
141
+
```
142
+
143
+
It prints lines like these after the startup lines:
144
+
145
+
```text
146
+
LAN address for a device build: http://192.168.1.20:9999/
147
+
Inject it as __PANGULAR_LAN_URL__, for example in an Angular CLI app:
148
+
ng build --configuration development --define "__PANGULAR_LAN_URL__='http://192.168.1.20:9999/'"
149
+
```
150
+
151
+
The `--define` flag needs the `application` builder of Angular 17.2 or later. The NativeScript overlay connects to the injected URL when you pass no `baseURL`, and `lanDevtoolsURL()` from `@pangular-inspector/devtools/overlay-manual` reads it in a Capacitor app. See [Set up Capacitor](../guides/capacitor.md#use-the-injected-lan-address) and [Set up NativeScript](./nativescript.md#use-the-injected-lan-address).
152
+
153
+
`--lan-address` only prints. It doesn't change the host the server binds to, the origin check or the one-time code. With `--host localhost`, the default, it prints a warning and no address, since a phone can't reach that server. `--lan-address 192.168.1.20` names the address, for a machine on several networks. A loopback address is refused.
154
+
134
155
### What it shows
135
156
136
157
When no app is connected, the tabs show what your source declares. An [Angular Native](./angular-native.md) app connects through the **Angular Native apps** URL above and shows live data there:
0 commit comments