on 11-17-2023 2:57 AM
I have a fragment: MyFragment. Sample code is:
// MyFragment
<Label id="my_label_id" text="my label" />
My fragment is contained by other views:
MyView contains both Fragment1 and Fragment2, and Fragment1 and Fragment2 contains MyFragment.
In MyView, there are 2 MyFragment, so it contains 2 Label with same ID: "my_label_id". This leads to a duplicated ID error.
How to deal with this error?
How do you instantiate the fragment? In the "MyView" or in a controller?
Option 1: in the view. See https://ui5.sap.com/#/topic/234320f8d8ee45b39c60893116d60351 You have to give an "id" to the fragment to enable prefixing of the fragment content.
Option 2: in the controller. See https://ui5.sap.com/#/topic/d6af195124cf430599530668ddea7425 by using the "loadFragment" API the ID prefixing is automatically enabled
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
10 | |
8 | |
6 | |
6 | |
6 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.