ScriptTagHelper Class¶
Summary¶
@!:ITagHelper- implementation targeting <script> elements that supports fallback src paths.
Constructors¶
-
ScriptTagHelper
(ILogger<Microsoft.AspNet.Mvc.TagHelpers.ScriptTagHelper>, IHostingEnvironment, IMemoryCache, IHtmlEncoder, IJavaScriptStringEncoder)¶ Creates a new [Microsoft.AspNet.Mvc.TagHelpers.ScriptTagHelper](Microsoft.AspNet.Mvc.TagHelpers.ScriptTagHelper.yml).
Arguments: - logger (ILogger{Microsoft.AspNet.Mvc.TagHelpers.ScriptTagHelper}) – The <see cref=”!:ILogger<ScriptTagHelper>” />.
- hostingEnvironment (IHostingEnvironment) – The @!:IHostingEnvironment-.
- cache (IMemoryCache) – The @!:IMemoryCache-.
- htmlEncoder (IHtmlEncoder) – The @!:IHtmlEncoder-.
- javaScriptEncoder (IJavaScriptStringEncoder) – The @!:IJavaScriptStringEncoder-.
public ScriptTagHelper(ILogger<ScriptTagHelper> logger, IHostingEnvironment hostingEnvironment, IMemoryCache cache, IHtmlEncoder htmlEncoder, IJavaScriptStringEncoder javaScriptEncoder)
-
Properties¶
-
AppendVersion
()¶ Value indicating if file version should be appended to src urls.
Return type: System.Nullable{System.Boolean} public bool ? AppendVersion { get; set; }
-
Cache
()¶ Return type: IMemoryCache protected IMemoryCache Cache { get; }
-
FallbackSrc
()¶ The URL of a Script tag to fallback to in the case the primary one fails.
Return type: System.String public string FallbackSrc { get; set; }
-
FallbackSrcExclude
()¶ A comma separated list of globbed file patterns of JavaScript scripts to exclude from the fallback list, in the case the primary one fails. The glob patterns are assessed relative to the application’s ‘webroot’ setting. Must be used in conjunction with [Microsoft.AspNet.Mvc.TagHelpers.ScriptTagHelper.FallbackSrcInclude](Microsoft.AspNet.Mvc.TagHelpers.ScriptTagHelper.yml).
Return type: System.String public string FallbackSrcExclude { get; set; }
-
FallbackSrcInclude
()¶ A comma separated list of globbed file patterns of JavaScript scripts to fallback to in the case the primary one fails. The glob patterns are assessed relative to the application’s ‘webroot’ setting.
Return type: System.String public string FallbackSrcInclude { get; set; }
-
FallbackTestExpression
()¶ The script method defined in the primary script to use for the fallback test.
Return type: System.String public string FallbackTestExpression { get; set; }
-
GlobbingUrlBuilder
()¶ Return type: Microsoft.AspNet.Mvc.TagHelpers.Internal.GlobbingUrlBuilder protected GlobbingUrlBuilder GlobbingUrlBuilder { get; set; }
-
HostingEnvironment
()¶ Return type: IHostingEnvironment protected IHostingEnvironment HostingEnvironment { get; }
-
HtmlEncoder
()¶ Return type: IHtmlEncoder protected IHtmlEncoder HtmlEncoder { get; }
-
JavaScriptEncoder
()¶ Return type: IJavaScriptStringEncoder protected IJavaScriptStringEncoder JavaScriptEncoder { get; }
-
Logger
()¶ Return type: ILogger{Microsoft.AspNet.Mvc.TagHelpers.ScriptTagHelper} protected ILogger<ScriptTagHelper> Logger { get; }
-
Src
()¶ Address of the external script to use.
Return type: System.String public string Src { get; set; }
-
SrcExclude
()¶ A comma separated list of globbed file patterns of JavaScript scripts to exclude from loading. The glob patterns are assessed relative to the application’s ‘webroot’ setting. Must be used in conjunction with [Microsoft.AspNet.Mvc.TagHelpers.ScriptTagHelper.SrcInclude](Microsoft.AspNet.Mvc.TagHelpers.ScriptTagHelper.yml).
Return type: System.String public string SrcExclude { get; set; }
-
SrcInclude
()¶ A comma separated list of globbed file patterns of JavaScript scripts to load. The glob patterns are assessed relative to the application’s ‘webroot’ setting.
Return type: System.String public string SrcInclude { get; set; }
-
ViewContext
()¶ Return type: Microsoft.AspNet.Mvc.ViewContext public ViewContext ViewContext { get; set; }
-