I plan to generate an Atom feed inside my AngularJS controller. A want to generate a view, but not on the server-side, because I want to replace the URI with a new AngularJS route.
Now I know how to write XML with JavaScript, but I have no idea about how to returning a XML content without a view.
My route setting is quite normal like below. It uses templateUrl to render a partial view.
.when('/posts', {
templateUrl: 'theme/post_list.html',
controller: PostsController
})
Is it possible to serve XML content without a view using AngularJS? Like so:
.when('/posts.atom', {
controller: PostsController
})
Generating the angular.js routed Atom feed on the server-side is possible, but I don't want it.
Use the following process:
<object>or<iframe>to the DOM with the XML within the tagOR:
Return Atom from the service
Store in a documentFragment
Use transformToFragment or DOMParser to create a view
Use XMLSerializer to convert the view to a string
Insert an XML stylesheet into the string:
Use the string as the value of the
srcdocattribute:For example:
References
insert an iframe into page dynamically in AngularJS
XML 1.0, Section 2.8: Prolog and Document Type Declaration
Embedded Content - HTML5: srcdoc
How to show RSS in an iframe or div?
Mozilla source: feeds/subscribe.css
AngularJs (all versions) breaks on IE11 in document mode ie=8
view-source: URI scheme
Feed View overrides XSLT stylesheet defined in XML document