npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngmaterial-mdcompiler

v1.0.2

Published

The $mdCompiler service ripped from angular material

Downloads

16

Readme

ngmaterial-mdcompiler Build Status

The $mdCompiler service ripped from angular material

Link to code

Install

$ npm install --save ngmaterial-mdcompiler

Usage

const angular = require('angular')
const mdCompiler = require('ngmaterial-mdcompiler')

angular.module('myApp', [
  require('ngmaterial-mdcompiler')
])
  .controller('MyCtrl', function ($mdCompiler) {
    // $mdCompiler.compile({ ... })
  })

API

The module is exposed as a string representing the module's name for easy inclusion (see above).

It creates a service $mdCompiler.

$mdCompiler.compile(options) -> Promise<compileData>

A helper to compile an HTML template/templateUrl with a given controller, locals, and scope.

options

An options object, with the following properties:

  • controller - {(string=|function()=} Controller fn that should be associated with newly created scope or the name of a registered controller if passed as a string.
  • controllerAs - {string=} A controller alias name. If present the controller will be published to scope under the controllerAs name.
  • template - {string=} An html template as a string.
  • templateUrl - {string=} A path to an html template.
  • transformTemplate - {function(template)=} A function which transforms the template after it is loaded. It will be given the template string as a parameter, and should return a a new string representing the transformed template.
  • resolve - {Object.<string, function>=} - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the compiler will wait for them all to be resolved, or if one is rejected before the controller is instantiated compile() will fail..
    • key - {string}: a name of a dependency to be injected into the controller.
    • factory - {string|function}: If string then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller.
  • locals - {object}: The locals which will be passed into the controller once link is called. If bindToController is true, they will be copied to the ctrl instead
  • bindToController - bool: bind the locals to the controller, instead of passing them in.

returns Promise<compileData>

Returns a promise, which will be resolved with a compileData object. compileData has the following properties:

  • element - {element}: an uncompiled element matching the provided template.
  • link - {function(scope)}: A link function, which, when called, will compile the element and instantiate the provided controller (if given).

License

MIT © Google