Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AngularJS support #1

Closed
lithammer opened this issue Feb 22, 2013 · 7 comments
Closed

AngularJS support #1

lithammer opened this issue Feb 22, 2013 · 7 comments

Comments

@lithammer
Copy link

http://docs.angularjs.org/api/

Unfortunately, I'm not very familiar with making syntax files for Vim.

@othree
Copy link
Owner

othree commented Feb 22, 2013

Maybe you can help summarize the keywords.
What are global objects? methods? properties?

AngularJS is very different from other libraries.
And these information are very unclear to me.

@lithammer
Copy link
Author

I'll give it a go.

But there's of course the global angular object, and here's a bunch of (jQuery Lite) methods attached to that object:

angular.bind
angular.bootstrap
angular.copy
angular.element
angular.equals
angular.extend
angular.forEach
angular.fromJson
angular.identity
angular.injector
angular.isArray
angular.isDate
angular.isDefined
angular.isElement
angular.isFunction
angular.isNumber
angular.isObject
angular.isString
angular.isUndefined
angular.lowercase
angular.mock
angular.module
angular.noop
angular.toJson
angular.uppercase
angular.version

And then theres the angular.module object with its methods and properties:

angular.module
angular.module.config
angular.module.constant
angular.module.controller
angular.module.directive
angular.module.factory
angular.module.filter
angular.module.provider
angular.module.run
angular.module.service
angular.module.value
angular.module.name (property)
angular.module.requires (property)

And there's the services, which are injected into functions kind of like so:

function AppController($scope, $http) {
    $http.get('http://example.com/api/test.json', function(response) {
        /* ... */
    });
}

These are the built-in services:

$anchorScroll
$cacheFactory
$compile
$controller
$document
$exceptionHandler
$filter
$http
$httpBackend
$interpolate
$locale
$location
$log
$parse
$q
$rootElement
$rootScope
$scope
$route
$routeParams
$templateCache
$timeout
$window

$cookies
$cookieStore
$resource
$sanitize

The $rootScope/$scope directives above have got the following methods and properties as well:

.$apply
.$broadcast
.$destroy
.$digest
.$emit
.$eval
.$evalAsync
.$new
.$on
.$watch
.$id (property)

Likewise, the $cookieStore has got the following methods:

.get
.put
.remove

$http has these:

.delete
.get
.head
.jsonp
.post
.put
.defaults (property)
.prendingRequests (property)

I'm sure I've forgot a bunch of things, but at least it's a beginning...

@othree
Copy link
Owner

othree commented Feb 22, 2013

Hi @Renstrom

This is very helpful. I have two questions about AngularJS need to solve before I can work:

  1. How will people use angular.module ?
    Will they always write:

    angular.module.name();
    

    Or they will use returned object to use the method provided by angular.module like:

    var cModule = angular.module(/* some args*/); //construnctor
    cModule.name();
    
  2. What is built-in services?
    It looks just like an argument inside function scope. But with a convention name. Am I right?

@lithammer
Copy link
Author

Yeah, basically the second approach is what you do, i.e.

var cModule = angular.module(/* some args*/); // constructor
cModule.name();

Although, some people like to chain them like this:

angular.module(/* some args*/).name()

But angular.module is a method which returns an object with a bunch of methods.

I guess you can think of them kind of like that, the concept is called "dependency injection" and is one of the main (if not the) feature of AngularJS. I'm not sure how to explain it but here's some info about it on Angular's homepage:

http://docs.angularjs.org/guide/di

@othree
Copy link
Owner

othree commented Feb 22, 2013

Thanks, I have learned a new stuff about DI.
AngularJS parse the function declare to see what the argument name is.

But I will treat them as global objects. It's hard to tell are they angular service or not.

@othree
Copy link
Owner

othree commented Feb 23, 2013

Basic support is pushed.
Supports angular global objects and add keywords for all services.

TODO:
Methods and properties for different services objects.

@othree othree closed this as completed Feb 24, 2013
@othree
Copy link
Owner

othree commented Jul 15, 2013

Add support ng-* attributes in html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants