ui-router icon indicating copy to clipboard operation
ui-router copied to clipboard

TypeError: Cannot read property 'name' of null at directive.link ([...]/angular-ui-router.js?v=0.1:894:77)

Open TheSharpieOne opened this issue 13 years ago • 13 comments

TypeError: Cannot read property 'name' of null at directive.link (http://localhost:3000/javascripts/lib/angular/angular-ui-router.js?v=0.1:894:77)

line:894: if (name.indexOf('@') < 0) name = name + '@' + (parent ? parent.state.name : '');

In the case where this error occurs, parent is set to: {name: "@", state: null}

image

TheSharpieOne avatar Jul 11 '13 18:07 TheSharpieOne

Can you post a Plunkr that replicates this? Have you created a build off of the master branch to verify that this issue still exists?

nateabele avatar Aug 12 '13 19:08 nateabele

I am experiencing this issue as well:

https://github.com/beninfobelt/angular-practice

beninfobelt avatar Aug 28 '13 14:08 beninfobelt

That's not a plunkr. :-)

nateabele avatar Aug 28 '13 15:08 nateabele

sorry -- I just posted it here: http://plnkr.co/edit/YVasCW

my first time with plunkr - forgive me if I did it incorrectly

beninfobelt avatar Aug 28 '13 17:08 beninfobelt

I don't think it's going to plunk properly because you're referencing scripts that aren't plunked (all that stuff in a bower_components directory).

EDIT: it also looks like you're double-referencing scripts, which may be problematic in any environment.

The goal of a plunker, in this case, is to isolate the problem in a small self-contained demonstration. See if you can cut way down on your app until you have a really small demonstration of the problem. And make sure all scripts are either loaded from an accessible source (e.g. the cdn) or in the plunker, which has no support for subdirectories.

laurelnaiad avatar Aug 28 '13 17:08 laurelnaiad

Thnx for the plunkr hints.

I am worried mostly about the ui-router issue before trying to figure out how to upload projects to plunkr.

Is it possible to take a look at my git address? https://github.com/beninfobelt/angular-practice

You guys are doing some amazing work with ui-router and I really want to put to use what you've put together.

Its just that I'm being held back by this issue:

TypeError: Cannot read property 'name' of null at $ViewDirective.directive.link (http://localhost:9000/bower_components/angular-ui-router/release/angular-ui-router.js:894:77)

and I am fairly positive that it is a result of the get calls in my peopleCtrl:

    $http({method: 'GET', url: 'http://search.ams.usda.gov/farmersmarkets/v1/data.svc/zipSearch?zip=60613', cache: $templateCache}).
        success(function(data, status) {
            $scope.domainStatus = status;
            $scope.domainData = data;
        }).
        error(function(data, status) {
            $scope.domainData = ['wrong', 'right'];
            $scope.domainStatus = status;
        });

I tried moving it to the dataFactory but had the same error.

beninfobelt avatar Aug 28 '13 17:08 beninfobelt

Is it possible to take a look at my git address?

Nope, sorry. This is an Open Source project run by volunteers in our free time. Our goal with this issue tracker is to help the greatest number of people as quickly as possible. If we had to clone and set up a project for each person who had an issue, we'd never get anything done! :-) Thanks for your understanding, and thanks for being respectful of our time. Please let us know when you have a Plunkr set up that demonstrates the issue.

nateabele avatar Aug 28 '13 18:08 nateabele

Sounds good guys - sorry for misunderstanding the protocal

I have taken your direction, sheared down the code and reposted: http://plnkr.co/edit/YVasCW?p=preview

In the process, the ~ TypeError: Cannot read property 'name' of null ~ issue has been eliminated (I think bc of Stu's suggestion to remove double-referencing scripts)

However, it is still not able to make the get call and displaying a Failed to load resource error.

I would be very grateful for any related insight you can provide.

Many thnx for your help with this as I become versed in the proper use of angularjs

beninfobelt avatar Aug 28 '13 19:08 beninfobelt

Looking at this, it seems unrelated to ui-router. I see the error, but not sure how a failed http.get is related to ui-router. Maybe your original error was more pertinent, but you've fixed that one.

timkindberg avatar Aug 28 '13 22:08 timkindberg

You were missing: <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular-resource.min.js"></script>

Other than that, it seems to work fine for me, except for a failed OPTIONS request to http://search.ams.usda.gov/farmersmarkets/v1/data.svc/zipSearch?zip=60613.

nateabele avatar Aug 31 '13 15:08 nateabele

Thanx Nate - it turned out the issue was related to incorrect syntax as well as a requisite to upgrade to the latest version of resource and angular itself

var dataService = $resource('http://search.ams.usda.gov/farmersmarkets/v1/data.svc/zipSearch?zip=:zip', {callback: 'JSON_CALLBACK'}, {get: {method: 'JSONP'}});
$scope.domainData = dataService.get({zip: 60613});

Thank you greatly for guiding me through the problem and for showing me the value/protocol of Plunker

http://plnkr.co/edit/9orfih?p=preview

beninfobelt avatar Sep 03 '13 13:09 beninfobelt

Alright, good deal. I assume that means we can close this?

nateabele avatar Sep 03 '13 14:09 nateabele

yes - good to close - many thnx

beninfobelt avatar Sep 03 '13 15:09 beninfobelt