angularjs-1.6

AngularJS All slashes in URL changed to %2F

北城余情 提交于 2020-01-18 04:13:07
问题 I'm having a massive problem with AngularJS routing. Up until recently everything has been fine with the following route: $routeProvider.when('/album/:albumId', { controller: 'albumPageController', templateUrl: 'views/album.html' }); and using the href: <a href="/#/album/{{album.id}}">Link</a> However, now all of the slashes are being encoded into %2F . So when I click the link, or type localhost:8000/#/album/1 into the browser, the URL is changed to: http://localhost:8000/#%2Falbum%2F1 I've

angularjs 1.6.0 (latest now) routes not working

不想你离开。 提交于 2020-01-08 08:50:09
问题 I was expecting to see this question on Stackoverflow but didn't. Apparently I'm the only one having this problem that seems to me to be very common. I have a basic project I am working on but the routes don't seem to work even though everything I've done so far seems to be right. I have this piece of html in my index.html file: <html> <head ng-app="myApp"> <title>New project</title> <script src="https://code.angularjs.org/1.6.0/angular.min.js"></script> <script src="https://code.angularjs

How to test Angular 1.6 component with injected service?

情到浓时终转凉″ 提交于 2020-01-05 08:10:27
问题 I want to test my Angular component which is syntactically based on John Papa's styleguide: 'use strict'; angular.module('MyModule') .component('MyCmpnt', MyCmpnt()) .controller('MyCtrl', MyCtrl); function MyCmpnt() { return { restrict: 'E', templateUrl: 'myPath/myTemplate.html', bindings: { foo: '=', bar: '<' }, controller: 'MyCtrl', controllerAs: 'vm' }; } MyCtrl.$inject = ['MyService']; function MyCtrl (MyService) { // controller logic } As you can see I want to inject MyService into the

Routing Demo stops working when updated to AngularJS 1.6

眉间皱痕 提交于 2019-12-25 03:16:31
问题 When I updated the code snippet from this answer to use AngularJS 1.6, it stopped working. The Login and Register links no longer change the view. The DEMO var app = angular.module("myApp", ["ngRoute"]) app.config(function($routeProvider) { $routeProvider.when('/', { template: `<h1>Login</h1>`, controller: 'loginCtrl' }) .when('/register', { template: `<h1>Register</h1>`, controller: 'RegisterCtrl' }) .otherwise({ redirectTo: '/' }); }); app.controller('loginCtrl', function($scope) { $scope

Angular Route - Extra # in URL

元气小坏坏 提交于 2019-12-20 03:31:47
问题 Learning some Angular - and I'm stuck on routing Here is my angular config var meanApp = angular.module('carz', ['ngRoute']); meanApp.config(function($routeProvider) { $routeProvider .when('/', { templateUrl: 'home.html', controller: 'mainCtrl' }) .when('/red', { templateUrl: 'red.html', controller: 'redCtrl' }); }); Here is are my links <a href="#">Home</a> <a href="#red">Red</a> When I load up my node app I am directed to http://localhost:8080/#!/ And I get my angular controller working as

Angular Route - Extra # in URL

a 夏天 提交于 2019-12-20 03:31:28
问题 Learning some Angular - and I'm stuck on routing Here is my angular config var meanApp = angular.module('carz', ['ngRoute']); meanApp.config(function($routeProvider) { $routeProvider .when('/', { templateUrl: 'home.html', controller: 'mainCtrl' }) .when('/red', { templateUrl: 'red.html', controller: 'redCtrl' }); }); Here is are my links <a href="#">Home</a> <a href="#red">Red</a> When I load up my node app I am directed to http://localhost:8080/#!/ And I get my angular controller working as

Routing issue with AngularJS project using yeoman setup [duplicate]

白昼怎懂夜的黑 提交于 2019-12-17 16:41:40
问题 This question already has answers here : AngularJS: How to remove #!/ (bang prefix) from URL? (6 answers) Closed 2 years ago . I have setup a new Angular project using yeoman. Angular version is 1.6.0. Project setup was successful but I have been facing an issue with routing Task runner - Grunt When I run the project in local my local page will load with URL http://localhost:9000/#!/ I was expecting http://localhost:9000/#/ When clicked on About link browser is routed to http://localhost:9000

Angular 1.6.0: “Possibly unhandled rejection” error [duplicate]

北城以北 提交于 2019-12-17 08:55:12
问题 This question already has answers here : Possibly unhandled rejection in Angular 1.6 (9 answers) Closed last year . We have a pattern for resolving promises in our Angular app that has served us well up until Angular 1.6.0: resource.get().$promise .then(function (response) { // do something with the response }, function (error) { // pass the error the the error service return errorService.handleError(error); }); And here is how we are triggering the error in Karma: resourceMock.get = function

Angular 1.6.0: “Possibly unhandled rejection” error [duplicate]

拜拜、爱过 提交于 2019-12-17 08:55:10
问题 This question already has answers here : Possibly unhandled rejection in Angular 1.6 (9 answers) Closed last year . We have a pattern for resolving promises in our Angular app that has served us well up until Angular 1.6.0: resource.get().$promise .then(function (response) { // do something with the response }, function (error) { // pass the error the the error service return errorService.handleError(error); }); And here is how we are triggering the error in Karma: resourceMock.get = function

AngularJS Upgrade (1.5 to 1.6,1.7) Makes directive scope bindings undefined

有些话、适合烂在心里 提交于 2019-12-17 06:50:49
问题 I have the following code: angular .module('myApp') .directive('layout', function () { return { restrict: 'E', template: '<div ng-include="layoutCtrl.pageLayout"></div>', controller: 'LayoutController', controllerAs: 'layoutCtrl', bindToController: true, scope: { pageLayout: '=', pageConfiguration: '=', isPreview: '=' } }; }); angular .module('myApp') .controller('LayoutController', LayoutController); function LayoutController($scope, LayoutDTO, LayoutPreviewDTO) { var self = this; self