The sfMediaField directive enables you to select and display a document or a video from the existing libraries in your website. In addition, you can use this directive to upload a document or a video to a library.
After you select a document or a video, the default template lists information about its base properties such as type, size and upload date. You can select another item or edit the properties of the current item. For more information, see Document selector and Video selector.
You can use the directive in the frontend, as well as in the backend. For example, on a page, as well as in a widget designer.
The sfMediaField is a directive with an isolated that is defined in a module with the same name: sfMediaField.
The following image is an example of a media field used for documents:
The sfMediaField directive exposes the following attributes:
Specifies the permissions that allow all users to access this selector. The options are:
NOTE: When you set the sf-master="true", the Media field lists the items but does not display their status.
The following example demonstrates how to add media field directive in a widget designer's view.
To enable AngularJs to link the sfMediaField directive in your custom designer view, you must load the script of the directive and add a dependency to the module:
Since there is no selected item when the controller is initialized for the first time, the sf-auto-open-selector attribute in the code above opens a document or a video selector depending on sf-media-type value. After you select an item, the item and its ID are stored in their respective scope variables: selectedMedia and selectedMediaId. The mediaProvider variable holds the name of the provider from which to load the document libraries.
NOTE: The document and the video selector can load documents or videos from different providers.
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important
Copyright © 2021 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.
Powered by Progress Sitefinity