shlogg · Early preview
Connie Leung @railsstudent

Angular 19.2.0 Streaming With Resource API

Angular 19.2.0 adds streaming support to Resource API, enabling functions to return multiple responses. `rxResource` & `resource` now stream data with `stream` option. Demo shows streaming table rows.

When the Resource API first came out, the resource function returned a promise, and the rxResource function only returned the first value of the Observable. It was particularly obvious in the rxResource function when

rxResource({
  request : this.num,
  loader: ({ request: n }) => timer(0, 1000).pipe(take(n))
})

    
    

    
    




emits one integer and complete,  not n integers.
Fortunately, the Resource API will support streaming where the functions can return multiple responses in Angular 19.2.0. 
The options of the rxResource function remain the same, but the resource function has a...