javascript,html,angularjs,focus,angular-routing
If you know which input you need the focus on, you can just add this to one of them. <input type="text" ... autofocus/> If you need to change which one gets the focus depending on some other variable, then you may need to add a custom directive to your form...
javascript,angularjs,angular-ui-router,angular-routing
There is a working plunker The point is - parameter is declared on child state, so only child state controller can access it Child state has controller: .state('messages', { url: '/messages', templateUrl: 'templates/messages/list.html', controller: 'MessagesCtrl' }) .state('messages.root', { url: '/:id', templateUrl: 'tpl.html', controller: 'ChildCtrl', }) Child controller has access to...
javascript,angularjs,angularjs-routing,angular-routing
.state('user', { url: '/:slug', params: { id: { value: -1 } }, I have used the above so the ids where not passed in the url. ...
You need to add ngRoute module in your app and also the script reference of the angular-route.min.js write after the angular.js, Also you need to add bsm.js and allBooks.js in your html after above two mentioned file has loaded. Code var app = angular.module('booksInventoryApp', [ 'booksInventoryApp.bsm', 'booksInventoryApp.allBooks', 'ngRoute' ]); Note...
i think you should use the date filter https://docs.angularjs.org/api/ng/filter/date or create your own : app.filter('getUtcDate', [ function() { return function(input) { return input.toUTCString(); }; } ]); and then you could do : <button type="submit" ui-sref="inventory({ expdate: expdate|getUtcDate })" class="btn btn-primary">Add</button> Edit : could you simply use : <button type="submit" ui-sref="inventory({...
You could try this, in your controller do this: .controller('testCtr', function($location){ this.search = { text:'', fn: $location.search.bind($location, 'text'); }; }) And then in your view do this: <div ng-controller="testCtr as vm"> <input type="text" ng-model="vm.search.text" ng-change="vm.search.fn(vm.search.text)"/> </div> ...
javascript,html,angularjs,angularjs-directive,angular-routing
I've solved the issue by changing the <ng-include> tag with an <div ng-include="srctoview"> tag. If anyone is having this issue i'd recommend doing this, or doing it like in this answer using a controller Thanks to @Sourabh- for leading me to an answer....
javascript,angularjs,angular-routing
It's rather unclear how you've set up things? Is the HTML your index or is that your home.html? Secondly you already declare the controllers of your pages to be appController, no need to define that with the ng-controller directive anymore. Apart from that you're loading the same template on each...
angularjs,github-pages,angular-routing
This is happening because angular is expecting that url to be relative to the root of the domain, not to the location of your app. In other words, it is expecting it to be relative to moroshko.github.io not moroshko.github.io/seekdeck. You can solve this easily by adding a base element to...
templateUrl can be used as a function if you need to work some magic on the url. It accepts 1 parameter which takes in the current url. Looking at your example, there aren't any parameters in /relatedStyle; but if there were you'd access and modify them like so: .when('/relatedStyle/:arbitraryParam',{ controller:'groupStylesLoad',...
angular-routing,http-options-method
Try this way return $http( { method: 'OPTIONS', url: apiUrl + '/Options?clientID=' + clientID } ).error( function ( a, b, c, d, e ) { console.log( 'err' ); } ); ...
angularjs,blueimp,angular-routing
Try this directive: ;(function( angular, $ ) { 'use-strict'; angular.module('mosaic').directive('a', [ function blueImpFix() { function prevent(e) { e.preventDefault(); } function unprevent() { $(this).unbind('click', prevent); } return { restrict: 'E', link: function(scope, elem, attrs) { if('gallery' in attrs) { elem.bind('click', prevent).on('$destroy', unprevent); } return elem; } }; } ]); })( window.angular,...
arrays,angularjs,asp.net-mvc-4,angularjs-filter,angular-routing
You can loop over the array to find out which is selected and push into the name array. <ul> <li ng-repeat="album in albums"> <input type="checkbox" ng-model="album.selected" value={{album.name}} /> </li> </ul> $scope.save = function(){ $scope.albumNameArray = []; angular.forEach($scope.albums, function(album){ if (!!album.selected) $scope.albumNameArray.push(album.name); }) } jsbin...
javascript,angularjs,angular-routing
Having a very similar Issue using angular-ui-router. The CSS is applying fine but the JS is doing nothing. no matter where I load it; wither that be in the index page or my home page. does the ng-view / ui-view act as a namespace? that and DOM loading sequence is...
You indeed can be more DRY than that. I would: Remove all go() functions from the views' controllers. Create a new controller (e.g. navCtrl) for the navigation "bar" Remove the ngClick directives from the <option> elements (since they don't seem to have any effect - at least in Chrome). Add...
angularjs,angular-routing,angular-ui-grid
use ng-routes in your application and give the url of the page you want to load as a templateUrl. then add $location.path('/path'); in the function you are calling.
django,angularjs,url,django-urls,angular-routing
If you want to serve the index.html for every url and then do the routing in angular you can do somethings like this in your <project_folder>.urls.py from <your_app> import views urlpatterns = patterns('', url(r'^.*$', views.index), ) ...
angularjs,twitter-bootstrap,navbar,angular-routing
I think ng-include directive could solve the situation you are facing. In controller code. .controller('HeaderCtrl', function($scope, $location) { $scope.$on('$locationChangeSuccess', function(/* EDIT: remove params for jshint */) { var path = $location.path(); //EDIT: cope with other path $scope.templateUrl = (path==='/signin' || path==='/contact') ? 'template/header4signin.html' : 'template/header4normal.html' ; }); }) In Html....
angularjs,html5,angular-routing
That's how it's working in mine and I'm not doing anything special? If I type mysite.com/angularapp/#/accounts/29 using Chrome, it gets replaced with mysite.com/angularapp/accounts/29 My routing config contains: function($locationProvider) { $locationProvider.html5Mode(true).hashPrefix(""); } I'm on Angular 1.2.21, I'm not sure if that behavior would have changed on 1.3.x....
javascript,angularjs,angular-ui-router,angular-routing
Drica! Using this implementation that @dfsq send, it will work, but this part app.controller('homeController', function($route) { window.route = $route; }); is not necessary if you use ui-route. Otherwise, this problem in the / route, you can use localStorage to save your json information and reload the page. In my tests,...
javascript,angularjs,angular-routing
What should happen is you should have ONLY ONE 'root' controller for a page, and any 'parts' of the page should be children of the root controller. $routeProvider .when('/store', { templateUrl: 'store.html', controller: 'StoreParentController' }) Then children can be declared in the HTML like so: <div ng-controller="StoreParentController"> <!-- you dont...
javascript,angularjs,angular-routing,normalize
I set up a github repository yesterday which is a starting point for a web app and contains this feature here If you look in public/app/app-routes.js you will see I have added resolve functions as variables, then you can simply do this rather than writing a whole function each time:...
javascript,angularjs,angular-routing
I created working example here. NOTE: It uses UI-Router instead of ngRoute... which I guess is really the right way... but the concept is exactly the same. Firstly we would define the resoruce "player": .factory('player', ['$resource', function($resource){ return $resource('player:playerId.json', {}, { findAll: {method: 'GET', isArray: true}, get: {method: 'GET', isArray:...
angularjs,angular-ui-router,angular-routing
Option-1: You can use $location service. var t = $location.search().token Option-2 If you are using ui-router, you may access the querystring parameters from $stateParams service too var t = $stateParams.token Cheers!...
angularjs,rest,angular-ui-router,angular-routing
I'll assume you have a REST api (based on your example containing /api/v1) which you want to expose/parallel as a UI. I'll assume you want to allow the user to drill down some hierarchical data model. Choices! There are many ways you could organize your states, for this drill-down list/details...
You have a typo in "teplateUrl". Changing it to "templateUrl" fixes your issue. .when("/user/:username", { "controller": "UserController", "templateUrl": "user.html" }) Updated fiddle here....
This is a known issue with the angular-router: https://github.com/angular/angular.js/issues/1213. The discussion suggests a workaround which is not pretty. As far as I can tell, angular-ui-router has the same issue - see some details here: https://github.com/johnpapa/generator-hottowel/issues/22. At the moment, the best solution is to avoid nesting ng-view using an ng-include.
angularjs,rest,angular-resource,angular-routing
You can always take out the logic of Facility.get({id: $route.current.params.id}); in some service/factory but that would IMHO be just over-engineering. Apart from this, I don't see much redundancy, since most of that code is just declaration of things.
javascript,angularjs,angular-routing
you can use the $locationProvider like this - $locationProvider.html5Mode({ enabled: true, requireBase: false }); Alternatively, you can use the base tag in your index.html (I suppose this is your landing page) <head> <base href="/"> </head> Removing base tag may cause some side effects in old IE browser like IE9...
angularjs,express,routing,mean-stack,angular-routing
With the mean stack (mongo, express, angular) you will have routing at both ends. Express will serve your static index.html and css/js/images and your api, and angular will interact with the api to get data from mongo. Routing with express will primarily be done for the API, and routing in...
You need to configure $resource for 2 different params. Right now you are using the same param twice in the url so there is no way to parse object keys into 2 different ones It should be more like: // factory contractor : $resource( base + 'projects/:id/:contid') // controller server.contractor.get({id:$routeParams.id,...
In your MainController.js file, you defined a new module with same name as in app.js: angular.module("githubViewer", []); What you want to do is retrieve the already defined module. You can acheive that by removing the []: angular.module("githubViewer"); Look here at the "Creation versus Retrieval" section....
angularjs,angular-ui-router,angular-routing
The point here is, that any call to 'demo.content' with different param process should re-call/re-init the controller of such state view. Other words, only controllers which are part of this state, could consume the process as a part of injected params. So, if there is really any part in main...
angularjs,angularjs-scope,angular-routing,angular-services
If you want it to wipe the value when they change routes (which logout should change routes also, I assume), you can watch the $routeChangeStart event and have it wipe the value whenever it occurs. You put that function in the module.run block: app.run(function ($rootScope, fact) { $rootScope.$on("$routeChangeStart",function(event, next, current){...
javascript,angularjs,firebase,angularfire,angular-routing
ng-click="form.storeCheck(); appCtrl.pageLoad(form.urlKey)" In this code, you are saying run appCtrl.pageLoad() straight after form.storeCheck() which would be fine if this was an offline application with no data involved but in relality, appCtrl.pageLoad should only be called when storeCheck has been resolved which is not what you have implied here. There are...
javascript,angularjs,redirect,angular-routing
I think your response.details has non-url encoded characters making the route provider think that you are navigating to a deeper page i.e. var response = {details:'bar/foo'}; would in effect be navigating to /view2/bar/foo triggering your otherwise.
javascript,angularjs,angular-routing
I have to make this workaround in the same situation: Define function in scope: $scope.scrollTo = function (id) { var old = $location.hash(); $location.hash(id); $anchorScroll(); $location.hash(old); }; And call it this way: <a href="" data-ng-click="scrollTo('anchor')">Scroll to anchor</a> ...
angularjs,google-chrome,angular-routing
As far as I know google chrome does not allow javascripts to be run from file system. But I did a quick google search and found this. Might be useful Link On the flipside you can use firefox. Firefox doesn't have such restrictions as far as I know...
javascript,html,angularjs,animation,angular-routing
When on a second level page the animation between that page and another second level page gets cut off the first time. Every other time it works fine. It sounds like this is a networking/caching issue. Someone in the comments section of that article had a similar issue and...
javascript,angularjs,angular-ui-router,angular-routing
There is a working example We can use params : {} object to define the userid exactly as we need (i.e. ready to be omitted). Check more details about params here: Angular ui router passing data between states without URL $stateProvider .state('viewallcards', { url: '/my-app/home/:userid', params: { userid: {squash: true,...
javascript,angularjs,angular-ui,angular-routing
All of your script tags are using absolute paths (they start with a /) except for the angular-bootstrap tags; they use relative paths. That means they are relative to wherever you are in the browser. Your javascript files are all located at www.website.com/Scripts/... because all of your script tags except...
javascript,angularjs,angular-routing
I have not found the right way to solve the problem, so I decided it so: in a $rootScope I create pageTitle variable, that contains my page title i bind pageTitle to the title of my html from server now I receive only html-content with ng-init="$root.pageTitle='Page title'" ...
By Setting Up the Routings On Server Side, this problem is solved
asp.net-mvc,angularjs,angular-routing
Angular is by design a Single Page Application (SPA) framework. It is designed to process requests within a single server page request, and handle route changes without making subsequent calls to the server. Hence, for every page load, the page is at the "root" of the application. or /, no...
angularjs,seo,http-status-code-404,pushstate,angular-routing
The real question is does http://example.com/pet/123456 return anything at all? If your starting point is http://example.com/ and there's a link to http://example.com/pet/123456 then Angular will call the petController which in turn makes an AJAX call to http://example.com/api/pet/123456. A crawler wouldn't do that but instead would try to call http://example.com/pet/123456 directly....
angularjs,angular-ui-router,angular-routing
If you home page is a plain static page - then nothing is required - the template for the home page is already cached in the $templateCache. Else if your home page has some data that is fetched from some service, I would suggest you to cache the data in...
angularjs,angular-routing,resolve,route-provider
If you inject the first resolve result (login in your case) to the the 2nd resolve, then that resolve will be delayed until that value is loaded. If it's not loaded or there is an error, it will not trigger: $stateProvider.state('/admin/:one/:two/:three?', { templateUrl: '/app/partials/admin.html', controller: 'AdminCtrl', resolve: { login: function(LoginService)...
angularjs,node.js,express,angular-routing
I may be wrong about this, but it seems that you may be confusing client side routes with server side routes. Routes defined via ngRouter are not supposed to hit server at all. I modified your code to make it work. It should be enough to let you go on...
javascript,angularjs,angular-routing
You need to use * in $routeProvider that will match all the characters in the url, when : is used it will match all characters till /. Change your code $routeProvider( when('/albums/:albumName), { templateUrl : 'albumsList.html', controller : 'albumsCtrl' }) To $routeProvider( when('/albums/:albumName*), { templateUrl : 'albumsList.html', controller : 'albumsCtrl'...
angularjs,angular-ui-router,angular-routing
I finally solved this ( I think). Looks like it's a dependency issue. Once I removed HistoryJS (1.8.0), everything worked as expected. <script src="/bower_components/history/scripts/bundled/html4+html5/native.history.js" type="text/javascript"></script> ...