javascript - How to change title of page based on drop down menu items in AngularJS -


I have an html file that displays a drop down menu that lets me use a php script from a remote database I'm getting taxed in an Ajax call I want to be able to change the title of this html page in the name of that item in the drop-down menu. For example, if I click on heating and cooling in the drop down menu, then I want to change it to the title of the page 'Heating and Cooling'. I have been googling around for the answer, but so far I have only left with more confusion BTW I am doing it in angular JS. Here is my html file:

  & lt; H2 & gt; Horrible things & lt; / H2 & gt; & Lt; Div ng-controller = "MainCtrl" & gt; & Lt; Span class = "dropdown" on-toggle = "toggle (open)" & gt; & Lt; A href class = "dropdown-toggle" & gt; Click me to see some amazing things! & Lt; / A & gt; & Lt; Ul class = "dropdown menu" & gt; & Lt; Li ng-repeat = "Tracks by Category $ Index in Categories" & gt; & Lt ;! - Fix this expression - & gt; & Lt; A href & gt; {{Category}} & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Span & gt; & Lt; / Div & gt;  

Here is my main control file: 'main.js':

  Angular Module ('yostartupApp'). Controller ('MainCtrl', function ($$ Scope.awesomeThings = ['HTML5 Boilerplate', 'AngularJS', 'Karma', 'SitePoint']; $ scope.status = {Iphen: Foti}; $ Skotoglade = Function ( Open) {Console.log ('dropdown is now:', open);} $ scope.toggleDropdown = function ($ event) {$ event.preventDefault (); $ event.stopPropagation (); $ scope.status.isopen =! $ Ajax call by creating Scope.status.isopen;}; // The current step does not work or does not work !!!! $ http.get ('http://test.s17.sevacall.com / Abhas / (function (data, position, header, config) {console.log (data); // debug $ scope.check = Data;}). Error (function (data, position, header, configuration)) {// log error}}}};  

Any help would be greatly appreciated! Thanks in advance!

This can be found only by using plain javascript

< Previous> Select & lt; id = "title_type"> & Lt; Option value = "Heading 2" & gt; Title 2 & lt; / Options & gt; & Lt; Option value = "title3" & gt; Title 3 & lt; / Options & gt; & Lt; Option value = "Heading 4" & gt; Title 4 & lt; / Options & gt; & Lt; Option value = "title 5" & gt; Title 5 & lt; / Options & gt; & Lt; / Select & gt; & Lt; Script & gt; . Document.getElementById ("title_select") addEventListener ("change", changeTitle); Function changeTitle () {var titleTemp = document.getElementById ("title_select") value; Document.title = titleTemp; } & Lt; / Script & gt;

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -