angular_ts
Build AngularTS interfaces in Gleam while keeping the page in HTML.
Add both packages:
npm install @angular-wave/angular.ts
gleam add angular_ts
Register a module, then bootstrap it after the page has loaded:
import angular_ts as ng
import angular_ts/component
import angular_ts/module
fn controller() { Nil }
pub fn main() {
ng.create_module("app")
|> module.component(
"welcomeCard",
component.new("<p>Welcome</p>", ng.inject0(controller)),
)
|> ng.bootstrap_body
}
Start with server-rendered HTML and add components only where the page
needs client-side behavior. See the package README and examples/basic_app
for the complete build and script-loading setup.
Types
pub type CookieOptions =
cookie.CookieOptions
pub type CookieStoreOptions =
cookie.CookieStoreOptions
pub type CurrencyFilterOptions =
filters.CurrencyFilterOptions
pub type DateFilterOptions =
filters.DateFilterOptions
pub type Element =
dynamic.Dynamic
pub type EntryFilterItem(key, value) =
filters.EntryFilterItem(key, value)
pub type GeolocationValue =
@internal GeolocationValue
pub type HttpMethod =
http.HttpMethod
pub type HttpRequestConfig =
http.HttpRequestConfig
pub type HttpRequestOptions =
http.HttpRequestOptions
pub type Injectable(value) =
injectable.Injectable(value)
pub type Injector =
@internal InjectorService(dynamic.Dynamic)
pub type NgModule =
module.NgModule
pub type NumberFilterOptions =
filters.NumberFilterOptions
pub type RelativeTimeFilterOptions =
filters.RelativeTimeFilterOptions
pub type StorageBackend =
storage.StorageBackend
pub type StorageType =
storage.StorageType
pub type Token(value) =
token.Token(value)
pub type WasmBinding =
dynamic.Dynamic
pub type WasmBindingOptions =
dynamic.Dynamic
pub type WasmError =
dynamic.Dynamic
pub type WasmErrorCode =
dynamic.Dynamic
pub type WasmLoadOptions =
dynamic.Dynamic
pub type WasmResource =
dynamic.Dynamic
pub type WasmResourceStatus =
dynamic.Dynamic
pub type WasmService =
dynamic.Dynamic
pub type WasmSource =
dynamic.Dynamic
pub type WasmTarget =
dynamic.Dynamic
pub type WorkerConfig(receive) =
worker.WorkerConfig(receive)
pub type WorkerError =
@internal WorkerError
pub type WorkerErrorCode =
@internal WorkerErrorCode
pub type WorkerHandle(send, receive) =
@internal WorkerHandle(send, receive)
pub type WorkerModelMessage(model) =
@internal WorkerModelMessage(model)
pub type WorkerRequest(payload) =
@internal WorkerRequest(payload)
pub type WorkerRequestOptions =
worker.WorkerRequestOptions
pub type WorkerResponse(result) =
@internal WorkerResponse(result)
pub type WorkerService =
@internal WorkerService
pub type WorkerStatus =
@internal WorkerStatus
Values
pub fn bootstrap(
root: dynamic.Dynamic,
modules: List(String),
) -> @internal InjectorService(dynamic.Dynamic)
pub fn bootstrap_body(
app: module.NgModule,
) -> @internal InjectorService(dynamic.Dynamic)
pub fn create_module(name: String) -> module.NgModule
pub fn create_module_with_requires(
name: String,
requires: List(String),
) -> module.NgModule
pub fn get_module(name: String) -> module.NgModule
pub fn inject0(
factory: fn() -> value,
) -> injectable.Injectable(value)
pub fn inject1(
token_a: token.Token(a),
factory: fn(a) -> value,
) -> injectable.Injectable(value)
pub fn inject2(
token_a: token.Token(a),
token_b: token.Token(b),
factory: fn(a, b) -> value,
) -> injectable.Injectable(value)
pub fn token(name: String) -> token.Token(value)