• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# StartAbilityParameter
2
3The **StartAbilityParameter** module defines the parameters for starting an ability. The parameters can be used as input parameters in [startAbility](js-apis-ability-featureAbility.md#featureabilitystartability) to start the specified ability.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8> The APIs of this module can be used only in the FA model.
9
10**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
11
12| Name              |   Type  | Mandatory  | Description                                   |
13| ------------------- | -------- | ---- | -------------------------------------- |
14| want                | [Want](js-apis-application-want.md)|   Yes  | Want information about the target ability.                    |
15| abilityStartSetting | {[key: string]: any} | No   | Special attribute of the target ability. This attribute can be passed in the call.|
16
17**Example**
18```ts
19import featureAbility from '@ohos.ability.featureAbility';
20
21let Want = {
22    bundleName: 'com.example.abilityStartSettingApp2',
23    abilityName: 'com.example.abilityStartSettingApp.MainAbility',
24};
25
26let abilityStartSetting ={
27    [featureAbility.AbilityStartSetting.BOUNDS_KEY] : [100,200,300,400],
28    [featureAbility.AbilityStartSetting.WINDOW_MODE_KEY] :
29    featureAbility.AbilityWindowConfiguration.WINDOW_MODE_UNDEFINED,
30    [featureAbility.AbilityStartSetting.DISPLAY_ID_KEY] : 1,
31};
32
33let startAbilityParameter = {
34    want : Want,
35    abilityStartSetting : abilityStartSetting
36};
37
38featureAbility.startAbility(startAbilityParameter, (err, data)=>{
39    console.log('errCode : ' + JSON.stringify(err));
40    console.log('data : ' + JSON.stringify(data));
41});
42```
43