Its not working
Closed this issue · 14 comments
First of all thank you for the effort in creating this project.
I have two files model.js and controller.js
The controller can't fetch the methods inside my model.
controller.js
angular.module('app.controllers')
.controller('CompanyProfileCtrl', [
'CommonModel',
function (CommonModel)
{
CommonModel. //no intellisense
}]);
model.js
angular.module('app.services')
.factory('CommonModel', function ($http)
{
function Model()
{
this.Search = function (json)
{
return $http({
method: 'POST',
url: companyUrl + 'Search',
data: json
});
}...
}
return new Model; // return factory
});
i added angular.intellisense.js to the same directory as angular.js, as instructed.
In the _references.js I pointed to angular.js and angular-ui-router.js (UI Router), maybe the UI Router is the problem ?
There's not really enough information here for an analysis of your issue. I can't see that your model.js class returns an appropriate factory. Create a Plunkr or pull request with a test case, marking the line where Intellisense fails and I will happily investigate your issue further.
I added the factory return. If you think its not clear, i will create a Plunkr and link you.
I don't see a linkage between your app.services module and your app.controllers module. Are they dependent on one another somehow? I will need to see that relationship (in a JavaScript file) for the test, so a Plunkr would be helpful.
ok I will create a Plunkr and link you, am currently at work... Thank you!
I might not have the time to create a Plunkr today maybe on Monday.
Have a nice weekend.
Hello jmbledsoe, I created a Plunkr. However it can't seem to inject my controller so its not working. But locally it is working
http://plnkr.co/edit/F4r3HpKDEbUkCyI5kKoL?p=preview
The reason your Plunkr wasn't working was because it didn't actually create the app.controllers and app.services modules, by specifying the "requires" parameter.
https://docs.angularjs.org/api/ng/function/angular.module
I believe that you're not getting Intellisense because the code does not establish a relationship between the app.services and app.controllers modules. When attempting to retrieve Intellisense within the controller, it doesn't have a relationship with app.services so doesn't resolve the dependency. Once this bug is fixed, you should get Intellisense. See my updates to the Plunkr:
http://plnkr.co/edit/BYC3mGNvVxRWXmkbi2bY
I'll leave the issue open awaiting your response.
I added the injection of the service inside the controller as you suggest, however its still not working.
And you added creation of the modules, because that was missing as well?
What is the content of your _references.js file? This file needs to be up-to-date in order for Visual Studio to be able to find all of your JavaScript files.
yup I added the inital [] to create the modules.
I have angularjs on the same directory as _reference.js
the _references.js
/// <autosync enabled="false" />
/// <reference path="angular-1.3.js" />
/// <reference path="angular-ui-router.js" />
You'll need your code files in there as well. Without references to
model.js, controller.js and app.js then Visual Studio won't be able to find
them, and so you won't get any Intellisense.
On Mon, Nov 24, 2014 at 9:27 AM, rtp-serge notifications@github.com wrote:
yup I added the inital [] to create the modules.
I have angularjs on the same directory as _reference.js
the _references.js
/// /// ///
—
Reply to this email directly or view it on GitHub
#14 (comment)
.
ok I added the reference to the model.js, controller.js, and app.js. However, its still not working :(
I checked the output windows (javascript) and all the files are being loaded properly.
The only thing I can suggest at this point is that you upload your project
(or a sample project that demonstrates the "not working") to a spot where I
can download it and look further.
On Mon, Nov 24, 2014 at 9:41 AM, rtp-serge notifications@github.com wrote:
ok I added the reference to the model.js, controller.js, and app.js.
However, its still not working :(—
Reply to this email directly or view it on GitHub
#14 (comment)
.
at this point I don't think i can do that, thank you a lot for trying to help out!
Closing the issue then.