Assign value to observable array angular. Get one object from observable array.
Assign value to observable array angular it doesn't keep states) but you can react to an event through it. The Observable in Angular is slim to keep the byte site of the library down. prototype. data = of([]); Deleting stored observable value in angular service. addComment(comment: IComment) { this. If the user is admi Aug 14, 2020 · Below code will assign empty observable array to the data object. I am using rxjs6 not rxjs5. Because if yes then there is something else wrong with my program. If we hit cancel then the only changes are to a disposable view variable. name = 'Bob') supposed to work. I want to add new card to the observables array and must reflect to array. json returns a string, the Sep 4, 2016 · observable$ will be a hot Observable that effectively replays the Promises value to Subscribers. from([1,2,3]). You can of course write your own checks to check if the value that is passed to the setter is valid. products = products; console. The input event is fired only when the user starts typing. This is my code so far: Apr 3, 2018 · If you want to make an observable produce values that you can access, then you have to subscribe to it. Oct 21, 2021 · I am taking an array of Workouts and want to turn it into an array of RoutineWorkouts which has all of the properties of Workouts as well as "sets" and "reps". data. So upon subscription you have to push the subscribed value (which is data ) to your leaderBoardTableData in the component. Jun 17, 2021 · You can either create a custom observable array to which you can subscribe to. Whatever type you assign to an observable doesn't change what the observable will actually emit. Dec 2, 2018 · Let's say if have an Array inside an Observable, for each value of that array, it want to make an API call (which returns an Observable again). You should do the following: this. We can use them to create new observable from the array, string, object, collection or any static data. additem = null; }); May 29, 2018 · Using observable, I want to filter and display a list. When I console log the testArray Array it is saying it is undefined. products$ = this. I am trying to assign a list of values (templates) from a rest service. key). In your question you are trying to do the following this. I need to modify the object inside the observable and then 'put it back inside' the observable again and return it. It is similar to a series of chained array functions on a normal array in JavaScript. Jan 9, 2021 · use the rxjs map operator to convert the value of an observable from one to another. assign({}, invoice) does is create a 1-level copy of invoice: So the object that it returns is a new object where it's property-values are those of the original invoice. Feb 5, 2019 · I have an API endpoint that's returning an array of strings (json) and I'm trying to create a page that spits out the contents via an Angular Service. import {Injectable} from '@angular/core Mar 29, 2018 · On Angular I write in the html template this code: <div *ngFor='let itemArray of myObservableArray'> <div *ngFor='let item of itemArray | async'> {{item I have an Observable array and I want to filter/find the Project by name. Jul 10, 2018 · Array. For your use case, I would leverage the scan operator and merge two streams into a single one: Jun 3, 2016 · If you need the value of an observable at a specific point in time I would convert it to a Promise and await for it like so: import { firstValueFrom } from 'rxjs'; const value = await firstValueFrom(obs$); The Observable would resolve immediately if it is an BehaviorSubject under the hood. When using arrays, e. But I have a problem when I type console. Theme is an interface, theme is an observable that emits a value of May 2, 2019 · First, switchMap expects you to return an Observable. filter and . Using async-await you will be able to fetch the data from subscribe in your local variables. But if you do want to try from, write the code like Jan 30, 2017 · To clarify what I mean about 'outside': accessing the values of 'this. The same goes for the naming of arguments, use plural form for arrays and singular form for non-array types. getHeroes() returns to the hereoes property, and reassigning it every time you add a Hero doesn't make much sense either. When we hit save it is up to the save method to persist the mutated object. This {type, value} is equivalent to {type: type, value: value} – May 17, 2020 · Dears, I am stuck, i have followed simple angular. However, it is not like a normal array. ts file. As pointed out in the comments, the above approach subscribes to the array and observes the values that are currently in the array, but it does not deal with changes to this Array. /shared/data. get<UserResults>(baseURL); } component. ts. You need to be treating the observable value as though it is a stream of arrays, rather than attempting to treat it like a stream of streams of items. find(key) . 1. component Option2: Define the array data without value field and update its value field later. Also, you dont need to use the async pipe because, in the tutorial, heroes$ is an observable which returns an array but it our case, games is just an array Aug 15, 2018 · A subject is a type of observable. observableComments. comments. I want to extract only the CityCodes from it and store in an Array. When transforming values into an array, there is no need for people$ to remain observable. an array of elements. As such, it is a stream. name----->> this works fine in Html, but I have no idea how to do it in typescript. When I try to use the filter option it is saying ProjectService. I got a Basket page subscribing to an Observable of an array in a BasketService, containing my customers orders. But be careful that the value field will be undefined unless you get response from this. It takes a projection function, in this case vale => value + 1 and applies it to every value in the array, then returns a new array. I am using Json placeholder site for the fake rest Api; I have a user class Object The list is an observable array: items$: Observable<Proposal[]>; Each item in the list has a child component. id === newItem. additem = (item) => observer. If you really want to get an array back on the stream — you should return a stream, e. _student. Once the item is added to the stream and broadcast, it will no longer be accessible in the subject's "list". keyService. someService. heroes); }); } Dec 26, 2019 · How to map object value to observable array. Angular Material's official documentation says: An alternative approach to providing data to the table is by passing an Observable stream that emits the data array to be rendered each time it is changed. Here is an example: Jul 11, 2018 · It takes a projection function, in this case vale => value + 1 and applies it to every value in the array, then returns a new array. I have done the services and the templates, I am starting to do the components. ngOnInit() { this. Here is my code in nav. subscribe({ next: (value) => console. I am having an issue assigning values to address1 as it does not directly exist in the ISurveyResponseDetail – Dec 8, 2018 · I am making angular application and where i am having an empty array like, users: any = []; Then i am making a service call in ngOnInit to store the data into users array like, ngOnInit() { Oct 14, 2018 · I'm using Angular 6 and Rxjs 6. If you want your Observable to emit a value of type Theme for example, you need to define an interface interface Theme { color: string } theme: Observable<Theme> Notice the use of capital and small T. If they are primitives (string/numbers), then they are copied as well, but if they are objects or arrays, it shares the reference on the original and in the copy. toArray(). You need to assign that observable to the variable and subscribe to it in the template, using the async pipe: In your case you don't need to define BehaviourSubject, because you are not maintaining state over the application. typescript code: ngOnInit() { this. getMissingProducts(). I'm not using any data services here. Sep 7, 2017 · In Angular 2+ (4. Then I want to display this array as a list on this page where I will be able to assign the reps and sets with ion-select. The code is quite simple. Feb 6, 2017 · Observable. How can I assign a default value to the observable this. Oct 21, 2021 · Objects and arrays are reference types so they store the location of their memory and doing a push on them does not change the location of memory for them. pipe( switchMap((data) => products$. 0. It is possible to click an icon on a single item, which changes the data of that child. Subscribinglink. Apr 25, 2018 · async-await : Observable and Promise are asynchronous and that's why your variables in subscribe method are undefined. Inside the subscription we create a new instance of population. Thanks for helping me. An observable begins publishing values only when someone subscribes Sep 3, 2019 · this is a workaround, because MatTableDataSource doesn't support Observable as data source. Aug 2, 2019 · The problem is I want to assign a value on a observable type interface. create-routine. 12. httpClient. forEach(item => { this. ts Feb 18, 2020 · how to assign values to an array using . Feb 20, 2019 · Appending the dollar is just a convention. Assign observable to variable in angular 8. Jul 3, 2020 · Hello folks I will keep my question very simpler by showing code. I want to delete the card from the observable and must reflect to the template. The response of API is good but the loop alteration did not assign each value to every array index. next("a new value"); will print this in the subscriber: The value is: a new value Aug 13, 2017 · I am calling an API that returns a JSON Object. findIndex(item => item. 3. Jun 21, 2020 · UserResults is my whole JSON. getHeroes(): void { this. Id, name, description. That becomes easier to see when you define expected types in your method signatures for both inputs (method arguments) and the return type. If you're forced into async, then you're out of luck. In your service component, write only the service. next(newValue) // the data of student observable is now set to newValue Feb 21, 2016 · How to convert hard coded array to Observable<T> in angular 6. Sep 9, 2021 · I have an endpoint that returns an Observable<Operacao[]>, but I need an array of your observable first. _student: BehaviorSubject<Student> = new BehaviorSubject<Student>(null); student: Observable<Student> = this. posts$: Observable<PostModel[]> I pass the observable to the template and it works fine using ngFor. push(comment); this. formattedDate' outside of the . Try Teams for free Explore Teams Apr 8, 2019 · I have a local JSON File with some data. this. Here is an example: import { from } from 'rxjs'; // Create an Observable from an array const observable = from([1, 2, 3]); Step 2: Subscribing to an Observable. prototype is a bad idea. When i click on the Aug 26, 2016 · There is no point assigning the Observable that heroService. But I want to set a default value from (product$ | async). 6) I am using the new HttpClient with a REST api. However, I don't understand how to assign that value to a variable that I can then use. Hot Network Questions Sep 5, 2021 · You can achieve that using switchMap & map operators, to create a new observable with the required data & products, like the following:. So Observable < Category[] > I want to sort. [] 3. /. Get string value from Observable<string> in typescript and Angular. map(r => r. Observable of array, find index of value. get and observables, but i am not able to render the data in the view. That depends only on how the observable is constructed. io Apr 28, 2023 · Observables are similar to arrays or other data structures but with a few key differences: Observables can emit multiple values over time, whereas arrays are static and contain a fixed Aug 4, 2023 · In this tutorial, we will show you how to create observable using create, of, from operators in Angular. I have the following interface: Sep 4, 2017 · I have a function in my angular component that receives an observable. subscribe(response Mar 10, 2021 · I am trying to make an API call and trying to assign data to an array but the last index value of API response is assigned to every array index which leads to assign the same value to all indexes of an array. cpt). May 2, 2021 · I am currently trying to convert an Observable into an Array so that I can iterate over the Array in HTML using ngFor. I'm not sure what you're trying to achieve, but this could help in specific situations. I have no benefit in learning these earlier versions as they are extinct. It's a hot Observable because the producer (in this case the Promise) is created outside of the Observable. Something like: new model. I am using angular 7 not angular 2. get<ApiResponse>(url); } Mar 28, 2018 · You can add a new method to your service like addData in which you can combine your previous data with new data like. subscribe(arr => ) to get it out. next() is no better than just calling a method to change the value! – Dec 18, 2017 · search element in array using observable in angular 2. create is called for every observer. All sorts of stuff can happen inside a Pipe; think of it as a series of steps of things that can happen to an object. . log(this. getListOfCustomer(currentPage: number): Observable<ListDto<CustomerList>> {} My variable this. items. en = { Jun 5, 2017 · Observable<string[]> is the type of observables where each emitted value is supposed to be an array of strings. So far, I am able to subscribe to the observable from UsernameService and I can show it in the console. This is my service: export class S Jan 17, 2019 · 1. heroService. You could implement it by hand, if you really wanted to: // overriding properties on Array. Angular2: getting service's property value before call a method. Then i want to send the CityCodes to the OpenWeatherMap API Request. log(nonLu) inside the subscribe method, I have the expected value. But how should I do it in this case? Observable with an Array. Oct 30, 2017 · My angular service is expecting a variable (currentPage) but as a type of number, the store select returns an Observable. Mapping Observable array of one type to an Observable array of a different type. find(item. filterLocation$ until the inputEvent starts to be triggered? template Sep 20, 2021 · How to set initial observable value in Angularjs2? How to initialize Typescript array interface with observable in Angular. import { Component } from '@angular/core'; import { DataService } from '. Whats my problem is that my Interface ISurveyResponseDetail has an property object of type IProperty which in turn has then the address1 etc. cartItems. I can even drill down and show one of the values from the object in the console. Dec 13, 2017 · If I have an observable student: Observable<Student> where Student has the parameter name: string is set to Jim, How can I change the value of name in the students observable to be Bob? Edit: Is student. There is no way back from async to sync. of is the correct method you are looking for. json translation file in angular and try to bind it to an object property as shown below code snippet. Nov 1, 2020 · There's no way to delete items from Observables. You should map the value of the Observable to a new filtered array. component. Get one object from observable array. See ngIf reference for details. countryOptions$ = of([]); Explanation. subscribe because it is the subscribe that tells the observable to Nov 21, 2016 · It is not going to store the value as in array inside its instance. So I have an interface of card lets say it has 3 properties. Feb 20, 2019 · I came into a problem while working with Angular and Observable. Jan 14, 2019 · Title shows empty and I think is because post$ is an Observable. public data = [ { 'key': 1}, { 'key': 2}, ]; constructor() { this. subscribe(); ie. The slim Observable does not have many of the useful operators that makes RxJS so productive. Oct 1, 2020 · Obviosuly cards will be the Observable of array of type card. subscribe on it and pass a callback to subscribe. Observable. 2. getCountryByName(countryName); The http call from the service returns an observable. When using an Observable of an array I have the following in the HTML template: Apr 10, 2018 · Angular turn Observable into an array. Angular automatically handles the unsubscription to the observable that is created in order to achieve this. subscribe in angular? Angular 2 change array value on subscribe. 14. But I have been searching for hours on how to give an initial value to "sizeSubject" (Subject), I like to assign the value on "evento", so the table appears ordered by evento as I show it. What I came up with is you can create a BehaviourSubject and subscribe to it. So if you want to get the array from Observable<isolementInterface> you would want result. http. If you have just a plain, non-array value you can skip the 2nd check (if). This might help. If I call api that just returns the array my service call works. log(data. In the subscribe method, i'd like to assign to the attribute "nonLu" a certain value (in this case res. Aug 18, 2017 · getLeaderBoard() method returns an observable of a single LeaderBoardModel element. pipe( map( payload => { // Perform the operations you want. But it returns Observable<T>, Is there a way to convert an array to Observable<T[]>? Jul 2, 2018 · How cast the observable to string? Observable from a string (Angular 2) 14. Angular HttpClient map Nov 26, 2021 · With customer = toSignal(customer$, { requireSync: true }) you can create a signal that updates when the observable value changes and access the 'immediate' value with customer() without the normal boilerplate described above. Jul 3, 2017 · I didn't quite understand what you meant here, but yes you can pass a value to an Observable. – Sep 17, 2019 · Thats not the issue i am having. Otherwise, I get undefined. – Apr 14, 2019 · But it's working a bit differently with Angular Material Table. If its an array-like value — it will turn it into an array using from (see this from example). To convert from observable to array, use obs. json()) and r. import { MatTableDataSource } from '@angular/material'; import The point of cloning the value that is unwaraped by the async pipe is so we don't mutate the contents of the observable. ISOLEMENTS as defined in your interface. While creating the new instance we create an array of the already known organisms together with the new one. Nov 17, 2015 · RxJS version 5 is a peer dependency with Angular. ts import { Injectable } from '@angular/core'; import { P The promise returns a value but I don't seem to be assigning the value properly in the subscribe method. map and whatever other chainable operator on the observable where you also can access the values, but you won't actually get any values unless you at some point down the line add a call to . My service: import { Injectable } from "@angular/cor Feb 16, 2018 · It cannot be done using observables as there is no way to watch the specific value of a variable and changing the value using a call to a Subject. Jan 2, 2020 · Make student as an Observable of some BehaviorSubject. Oct 15, 2021 · In a service I have a GET request to an API. onNext(this. Here's what I have thus far (I'm on Angular 7 Nov 30, 2017 · What Object. Assigning Priority in Cyclic Isomers Errors as values and Generic Option, Result types in C++ Jun 16, 2020 · In your example that would be after you are assigning the returned value of the request to heroes property. However, it might work, I will just need to find the non-null value in the result array as an additional step. The Angular framework and tooling do not enforce this convention. Feb 12, 2018 · You can try to use a BehaviorSubject to store the user object: In your service: private myUser = new BehaviorSubject<UpdateUser>(null); getUser() { // Mar 6, 2017 · All I want to do is add a value to my observable array so that my UI updates. This is basically saying that theme is an Observable that emits a string. data$. the values aren't only locally accessible to the observable, but to the scope of the receiving variable. One issue that is probably sim Aug 21, 2020 · I am trying to get array value from en. from(array). returnCustomObservable() { return Observable. apiService. heroes = data; // <- after this point you have the result console. Inside this callback you will receive data from observable via callback parameters and than you can assign this data to local variable. Note that more correct usage of Observable. filter array function, which filters certain elements out of an array. you first subscribe to getIcons() function, then returns the observableOf(false) and only then, the subscription occurs. Local variables aren't implemented in Angular as of now, this closed issue can be monitored for the references to related issues. undefined 2. Assign new Observable to Jan 31, 2021 · I am very new to Angular. I'm doing this so that instead of an HTTP request I can return hard-coded data. – Pankaj Parkar. You can add an item (such as a book) to the stream and the item will be broadcast to any observers of the stream. If the observable isn't reused, it isn't necessary to save it to noteList, but a subscription possibly needs to be saved in order to unsubscribe it and avoid memory leaks: May 10, 2018 · I just want to sort data on an observable of my class type 'Category'. g. 3. The following code will throw undefined at the ListFormsComponent over and over and over until the Observable is assigned by getForms() at which it will then displa Feb 5, 2016 · This way you can create Observable from data, in my case I need to maintain shopping cart: service. You could implement it by hand, if you really wanted to: Jul 6, 2017 · toArray "collects all source emissions and emits them as an array when the source completes. Also learn the difference between the Of & From operators. value; // get current items in cart const Nov 5, 2018 · How can you convert an array to an observable array in angular 6. Jul 15, 2019 · I want to convert an array to type Observable<T[]> and have used the rxjs method "from". To subscribe to an Observable, you can use the subscribe method. next(item); return => this. Mar 29, 2019 · observable. It may also take a resultSelector function to produce the output value from the input value, and a defaultValue to emit in case the source completes before it is able to emit a valid value. The values in your observable are single points of data that each contain their own array. itemArray. May 7, 2018 · You could create a new file which exports the model class and then assign it to the returning Observable type. However, there are operators in the RxJS library such as filter and skip that can filter/leave out whatever values you request from an Observable, but the values will still remain in the orginal Observable. Apr 4, 2016 · Since the load method returns an Observable, I have to use the subscribe method in home. using of: switchMap(value => of([])) Yet, in your case, you want to substitute each id in the array with Mar 27, 2019 · The code needs to make a distinction between an array and an object when performing an operation. import { of } from 'rxjs'; this. Here's what you can do: Here's what you can do: import 'rxjs/add/operator/map'; Jul 29, 2016 · Rx. ts Jun 27, 2017 · The callback to Observable. subscribe isn't putting data inside my array. I need just the value of the array to map to a Observable . asObservable(); then to update the value of the observable student, we can do . I'll break it down to a simple example. Assign an observable to an array in angular 4. This is my Typescript code currently. " lastValueFrom just converts the last (well, the only, since toArray scoops up everything) value of the array to a promise. Since Angular 4 the syntax of ngIf and ngFor directives was updated to allow local variables. const result$ = this. e. Notice that I only take one value of the stream, take(1 You are trying to assign the actual value of Country to the observable. Dec 31, 2023 · #How to declare and initialize an observable Array of Objects in Angular #Convert Observable Array to/from Array #Convert Observable to An Array with an example 5 days ago · To create an Observable, you can use the from operator from RxJS. Dec 2, 2016 · If called with a predicate function, first emits the first value of the source that matches the specified condition. That said, your code with forkJoin does look correct. id); this. See full list on angular. Http request made multiple times in Angular2 service. My use case is. export interface LocalConsultationCachingModel { cache: ConsultationModel[]; httpPromise: Observable<ConsultationModel[]>; } I want to assign on httpPromise: Observable<ConsultationModel[]>; } Dec 18, 2020 · Im trying to assign all the values that I receive from a JSONArray into a Interface instance. service. The child has an event emitter to tell the parent the data has changed: @Output() proposalDataChanged: EventEmitter<string> = new EventEmitter(); Mar 14, 2018 · Yes, when you just pass the property, it creates a key with the same name. In this case I have an object with two properties - type and value. I don't get what the problem is you have with subscribe()? Is it that the value is async? Don't use Observable if you don't want async. items[indexToUpdate] = newItem; // some angular libraries require breaking the array reference // to pick up the update in the array and trigger change detection. Update: showUpdatedItem(newItem){ let indexToUpdate = this. Therefore the list is not displayed at the first place. create would look like this: const signal = Observable. I am trying to return an observable while having an array. Angular 6 add items into Observable. please see the component also in the tutorial. Mar 29, 2017 · As you see its working pretty cool, every time I click on the column Title Button, my table get the order of that column. If you do observable. country$ = this. asObservable(); // I need to maintain cart, so add items in cart addCartData(data) { const currentValue = this. pipe( map((products) => { data. So it is possible to do May 11, 2020 · You need to subscribe to the observable by calling . create((observer) => { this. And I need only users in my users Array not item. On my project, I'm using rxjs5-beta6 and import { Observable } from 'rxjs/Observable'; was enough to use the of method. map is the magic that lets us do this. Oct 18, 2017 · In AnotherService, I want to inject a value from the UsernameService object. Sep 18, 2021 · Now what I want is to set the default value of Form from Product$ (observable) The above code sets the default value of name ''. see the code below Also, if you want a property to hold the most recent value emitted from an observable, it can be convenient to use the source observable's root name without the "$". page. My goal is to subscribe to the observable and assign a value to each element's property of the array in the response. import { BehaviorSubject } from 'rxjs'; arrayChanged = new BehaviourSubject(false); //The function where actually the array is updating fun update() { Oct 31, 2019 · So in the above the Observable emits 3 values. class FieldModel { Field1: string; Field1: string; } export class valuesModel { MyValues: Array<FieldModel>; } on the service. A slim Observable is used in Angular core. Every time you want to change arrays and objects in Angular, do them immutably (assign new values so the location in memory changes and change detection takes place). ts Jul 4, 2016 · You can't do it this way since you can't "update" an observable (i. Feel free to use it or not. The result of the array is the object itself and not the array within that object. The filter operator that you are using can only be used to allow or discard values emitted by the Observable, it is unrelated to the . Jul 12, 2018 · I have a feeling that you try to bind the list in the view or use it somewhere as an array. So I upgraded to Angular6 and rxjs6 with it. So simply you can use like following. Then we next the new/updated population onto the stream. io tutorial for http. But I don't know how to do that. Commented Nov 21, 2016 at 11:50. The JSON data I receive are like this: 0: attack_type: "Melee" id: 1 legs: 2 localize Sep 20, 2017 · An Observable doesn't "have" a value, it emits a value when the source emits a value. products); return data; }) ) ) ); // Now you can subscribe to the new `result$` observable, and get the data with products Mar 7, 2020 · Your addIcons() function always returns an observable of false. Notice this does return an observable of an array, so you still need to . countryOptions$ = [] which is incorrect because you are trying to assign an array to type Observable which are not Jun 13, 2020 · Now if you want to store the value in an array you can follow this approach: Angular Loop on fetched observable array data and fetch another array of data in it. export class OrderService { cartItems: BehaviorSubject<Array<any>> = new BehaviorSubject([]); cartItems$ = this. subscribe(x => // do something with x); Subscribe to changing array. subscribe(data => { this. – Feb 13, 2023 · This is somewhat problematic since each observable will only emit once and there are hundreds of observables in the list. map(student => student. getHeroes() . The api returns a json object defined as follows: { count: number, results: MyObject[] } In my api service I have the following function to retrieve the data: public getList(): Observable<ApiResponse> { return this. How to convert an Observable of an array of objects into a different type in Angular. of('Your value here'); } However, if I got you correctly, this means you have to rewrite the onMessage function to give it the value you want. I am asking about an Observable(boolean) concept when this question does not mention Observable(boolean) I created an Observable value that I want true/false from it. Sure you can first use . Next, assign the the array you Angular Observable to Aug 20, 2017 · To convert from array to observable you can use Rx. public getUsers(): Observable<UserResults> { return this. Sep 19, 2018 · So we subscribe to the observable that holds the population. It is initialised with heroes$ only. Without editing HeroService, you can improve the HeroListComponent like so: Oct 10, 2019 · If all you want is to get an empty array from your Observable, then the following should do. comments); // The above does not work // neither onNext - next - push is a function on my observable array?? Apr 30, 2018 · The proper way to do this with RxJS is to subscribe an observable and do all necessary actions with result inside subscribe callback. To use extra operators we import them like so: import { map } from 'rxjs/operators';. This is an example for arrays. Ask questions, find answers and collaborate at work with Stack Overflow for Teams. log("The value is: ", value) }); Then the output will be: The value is: initial value After that, every time you invoke next all the subscribers will receive the notification: observable. 7. Link;. currentPage$ is currently a type of Observable<number> How can i convert an Observable<number> to a number to pass it to my service? Feb 13, 2020 · Once you get your head around the concept of Subject and Observable, you might understand the idea of the Observable Pipe. opdajwujfgbkyzqzmolqcrdjbtupzspdisqjjgbuxniycxcqfvltbnassindifkfojhpyqtkz