HTML5 mobile App Development (3)
Course Content:
Follow the ANGULARJS MVC framework for code refactoring, creating a new DataService service class that uses the SQLite plugin to store local storage of contacts.
Points of knowledge involved:
Angular2 injectable's use of mature module dependency Injection
Referencing a class library
Referencing SQLite plugins and storage,sqlstorage modules
Refactoring code to create a new model
Create a new modules directory, create a new contact.ts, define the type of the field
Create a new DataService
Reference class or plugin pack
Import {storage,sqlstorage} from ' Ionic-angular ';
Import {Contact} from '. /modules/contact ';
Key words
@Injectable ()
That can depend on the injected
Registering a new service
Modify App.ts
Injecting a custom service class
Import {DataService} from './pages/services/dataservice ';
Providers:[dataservice],
Using DataService
Referencing a class library
Import {Contact} from '. /modules/contact ';
Import {DataService} from '. /services/dataservice ';
Injection Services
Private Dataservice:dataservice
Run Test
OK Finish
Next talk about developing custom components (Component) for modular development
HTML5 mobile App Development (3)