I am still new to angularJS. I am trying to create a custom button and use it on a regular basis. Rather than engage it in my form. I have tried many approaches and so far none of them is doing a good job. Now when I enter the input field, the main page I see for "results" loads mainly. But when I click on the search button "a" link tag the view load disappears instantly. Also in the "results" the position of the browser changes goes back to "/ # /" and I do not know why and why this is due.
Here's my HTML:
& lt; Div id = "search-container" ng-controller = "searchcontroller" & gt; & Lt; Form ng-submit = "submit ()" & gt; & Lt; Div & gt; & Lt; Input id = "keywords" name = "keyword" ng-model = "query keywords" placeholder = "please enter query" value = "" / required /> & Lt; Br> & Lt; A href = "#" id = "search-btn" ng-click = "submit form ()" & gt; & Lt; Img src = "/ images / search-icon.png" alt = "search" title = "search" / & gt; & Lt; / A & gt; & Lt; / Div & gt; & Lt; / Form & gt; & Lt; / Div & gt; Here are my models and ngj controllers:
var bfapp = angular.module ("blogfinder", []). Config (function ($ routeProvider) {$ RouteProvider.when ('/ results', {templateUrl: 'PartialViews / results.html', Controller: 'Result Editor'}); $ route provider. Otherwise ({redirectTo: '/'}) ;}); Bfapp.controller ('Result Checker', Function ($ scope) {}); Submit $ scope.submitQuery = function () to form {if ($ scope.query) on Bfapp.controller ('SearchController', function ($ radius, $ location) {$ scope.query = {keyword: ""}; // form Keyword! == Faucet) Click the button at {$ location.path ('/ results');}}; // $ scope.submitForm = $ scope.submitQuery;});
Well I feel so stupid I used to have my head up for a few hours Solution has been found only after beating it, though it has never been mentioned on any site. All of me "code" of "code" and "#" id = "search-btn" ng-click = "submitForm ()" & gt; to remove. Now it works like a charm.
No comments:
Post a Comment