Skip to content
Bharath Upadhya edited this page May 12, 2015 · 16 revisions

How to use the component?

  • Install the bower component

      bower install https://github.com/bharathvu/bharath-directives.git
    
  • Refer the dependencies within your index.html file

      <script src="bower_components/angular/angular.min.js"></script>
      
      <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
    
      <script src="bower_components/bharath-directives/search.js"></script>
    
      <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    
  • Inject the component module into your main module

      angular.module('app_name', ['bharath-directives']);
    
  • Use the directive

      <country-search></country-search>
    
  • Move the env.json file to the directory where Gruntfile.js is located

  • Add the script to your Gruntfile.js

      grunt.initConfig({
          replace: {
              example: {
                  src: ['bower_components/bharath-directives/search.js'], // source files array (supports minimatch) 
                 overwrite: true,
                 replacements: grunt.file.readJSON('env.json')
              }
          }
      });
    
  • Don't forget to register NpmTask

      grunt.registerTask('default', ['replace']);
    
  • In your project's gruntfile directory, run:

      npm install grunt-text-replace --save-dev
    
  • Then add this line to your project's gruntfile:

      grunt.loadNpmTasks('grunt-text-replace');
    
Clone this wiki locally